Add jobs to process queue when csv is uploaded

This commit is contained in:
Eli Ribble 2026-02-08 05:06:47 +00:00
parent f9c8f37cec
commit aee17d2c7a
No known key found for this signature in database
2 changed files with 16 additions and 0 deletions

View file

@ -17,6 +17,20 @@ type jobImportCSVPool struct {
var channelJobImportCSVPool chan jobImportCSVPool
func ProcessUpload(file_id int32) {
enqueueUploadJob(jobImportCSVPool{
fileID: file_id,
})
}
func enqueueUploadJob(job jobImportCSVPool) {
select {
case channelJobImportCSVPool <- job:
log.Info().Int32("file_id", job.fileID).Msg("Enqueued csv job")
default:
log.Warn().Int32("file_id", job.fileID).Msg("csv channel is full, dropping job")
}
}
func startWorkerCSV(ctx context.Context, channelJobImport chan jobImportCSVPool) {
go func() {
for {