Job deletion: avoid looping over entire list of jobs when queue full

When there are more job deletion requests than can be kept in the queue,
just stop trying to queue them.
This commit is contained in:
Sybren A. Stüvel 2023-03-21 10:44:28 +01:00
parent 7963ab5efd
commit b25e63f557

View File

@ -126,13 +126,14 @@ func (s *Service) queuePendingDeletions(ctx context.Context) {
return
}
queueLoop:
for _, jobUUID := range jobUUIDs {
select {
case s.queue <- jobUUID:
log.Debug().Str("job", jobUUID).Msg("job deleter: job queued for deletion")
case <-time.After(100 * time.Millisecond):
log.Info().Msg("job deleter: job deletion queue is full")
break
break queueLoop
}
}
}