wip: port queue.StartAnalyses

This commit is contained in:
Michael Hohn
2024-05-20 20:07:39 -07:00
committed by =Michael Hohn
parent cf595f338a
commit 8cd4f4d809
3 changed files with 45 additions and 2 deletions

31
pkg/queue/queue.go Normal file
View File

@@ -0,0 +1,31 @@
package queue
import (
"log/slog"
"mrvacommander/pkg/storage"
co "github.com/hohn/ghes-mirva-server/common"
)
var (
NumWorkers int
Jobs chan co.AnalyzeJob
Results chan co.AnalyzeResult
)
func StartAnalyses(analysis_repos *map[co.OwnerRepo]storage.DBLocation, session_id int,
session_language string) {
slog.Debug("Queueing codeql database analyze jobs")
for orl := range *analysis_repos {
info := co.AnalyzeJob{
QueryPackId: session_id,
QueryLanguage: session_language,
ORL: orl,
}
Jobs <- info
storage.SetStatus(session_id, orl, co.StatusQueued)
storage.AddJob(session_id, info)
}
}