change longpoll job array param type

This commit is contained in:
ycc
2025-05-04 23:19:18 +02:00
parent 839fb7c0f9
commit 511e260157

View File

@ -192,7 +192,7 @@ func ReadMessage(messageFilename string) ([]string, []string, string, error) {
} }
// CheckForMessages checks for messages on a single server // CheckForMessages checks for messages on a single server
func LongPollForMessages(storage_path string, jobs []client.RequestsJob, timeout int, longPoll bool) (int, string, error) { func LongPollForMessages(storage_path string, jobs []*client.RequestsJob, timeout int, longPoll bool) (int, string, error) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
@ -203,7 +203,7 @@ func LongPollForMessages(storage_path string, jobs []client.RequestsJob, timeout
for _, job := range jobs { for _, job := range jobs {
wg.Add(1) wg.Add(1)
go func(job client.RequestsJob) { go func(job *client.RequestsJob) {
defer wg.Done() defer wg.Done()
for { for {
@ -211,7 +211,7 @@ func LongPollForMessages(storage_path string, jobs []client.RequestsJob, timeout
case <-ctx.Done(): case <-ctx.Done():
return return
default: default:
cnt, _, err := CheckForMessages(storage_path, &job, timeout, true) cnt, _, err := CheckForMessages(storage_path, job, timeout, true)
if err != nil { if err != nil {
continue // Optionally handle/log error continue // Optionally handle/log error
} }