mirror of
https://github.com/glanceapp/glance.git
synced 2025-07-13 04:55:32 +02:00
Avoid spinning up unnecessary goroutines for single data jobs
This commit is contained in:
@ -181,6 +181,11 @@ func workerPoolDo[I any, O any](job *workerPoolJob[I, O]) ([]O, []error, error)
|
||||
return results, errs, nil
|
||||
}
|
||||
|
||||
if len(job.data) == 1 {
|
||||
output, err := job.task(job.data[0])
|
||||
return append(results, output), append(errs, err), nil
|
||||
}
|
||||
|
||||
tasksQueue := make(chan *workerPoolTask[I, O])
|
||||
resultsQueue := make(chan *workerPoolTask[I, O])
|
||||
|
||||
|
Reference in New Issue
Block a user