Currently resources are leaked when EventPoller.Poll() returns from the <-ctx.Done() branch of the select because a time.Ticker must be stopped to release associated resources.
This PR fixes the issue by adding a .Stop() call on the branch. The time.Ticker is also switched to a time.Timer since only one event is used and time.Timer is more suitable. Alternatively, it would be enough to just add a .Stop() call for time.Ticker.
Currently resources are leaked when
EventPoller.Poll()
returns from the<-ctx.Done()
branch of the select because atime.Ticker
must be stopped to release associated resources.This PR fixes the issue by adding a
.Stop()
call on the branch. Thetime.Ticker
is also switched to atime.Timer
since only one event is used andtime.Timer
is more suitable. Alternatively, it would be enough to just add a.Stop()
call fortime.Ticker
.