More debugging!
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Tyler 2021-03-07 00:02:55 -05:00
parent 065ffcd3bb
commit 16fc55f38e

12
main.go
View File

@ -106,11 +106,17 @@ func scanHandler(w http.ResponseWriter, r *http.Request) {
wg.Done()
}
log.WithField("contentType", contentType).Debug("Adding files from multipart form as jobs")
fileCount := 0
for _, files := range r.MultipartForm.File {
// Append files
for _, file := range files {
wg.Add(1)
fileCount++
f, err := file.Open()
if err != nil {
@ -126,6 +132,8 @@ func scanHandler(w http.ResponseWriter, r *http.Request) {
}
}
log.WithField("count", fileCount).Debug("Waiting for jobs to finish")
wg.Wait()
json.NewEncoder(w).Encode(results)
@ -137,6 +145,8 @@ func scanHandler(w http.ResponseWriter, r *http.Request) {
},
}
log.WithField("contentType", contentType).Debug("Scanning contents of body")
jobChan <- job
}
}
@ -204,6 +214,8 @@ func worker(rules *yara.Rules) {
for {
job := <-jobChan
log.Debug("Processing job")
processJob(s, job)
}
}