hibiken / asynq

Simple, reliable, and efficient distributed task queue in Go
MIT License
9.49k stars 688 forks source link

[BUG] Memory leaks caused by time.After #913

Open biningo opened 4 weeks ago

biningo commented 4 weeks ago

Describe the bug timer.After() creates a new timer object each time it is called. Which can cause a memory leak in the for loop. https://github.com/hibiken/asynq/blob/d04888e74845fc7434c6a50755e62ec6ffda5911/subscriber.go#L61-L74 https://github.com/hibiken/asynq/blob/d04888e74845fc7434c6a50755e62ec6ffda5911/syncer.go#L60-L85 To Reproduce

Expected behavior Creating the timer object before the for loop.

Screenshots

Environment (please complete the following information):

Additional context