mirror of
https://github.com/acaloiaro/neoq
synced 2026-07-21 18:29:08 +00:00
fix: Accumulation of cancel() funcs enqueueing on pg backend
`cancelFuncs` in the pg backend was intended for gracefully shutting down the backend with Shutdown(). Adding a new cancel function every time a job is added to a queue isn't of any use, because there is nothing to "cancel" by cancelling the context unless a job is in progress. This was effectively a memory leak.
This commit is contained in:
parent
d66905fadd
commit
bf2e07cf57
1 changed files with 0 additions and 4 deletions
|
|
@ -239,10 +239,6 @@ func (p *PgBackend) Enqueue(ctx context.Context, job *jobs.Job) (jobID string, e
|
|||
}
|
||||
|
||||
p.logger.Debug("enqueueing job payload", slog.Any("job_payload", job.Payload))
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
p.mu.Lock()
|
||||
p.cancelFuncs = append(p.cancelFuncs, cancel)
|
||||
p.mu.Unlock()
|
||||
|
||||
p.logger.Debug("acquiring new connection from connection pool")
|
||||
conn, err := p.pool.Acquire(ctx)
|
||||
|
|
|
|||
Loading…
Reference in a new issue