lua-resty-timer icon indicating copy to clipboard operation
lua-resty-timer copied to clipboard

If 'timer' is collected, have any logs will be printed?

Open GoneGo1ng opened this issue 4 years ago • 1 comments

I have some trouble. Sometimes the timer will stop executing inexplicably, and it is difficult to reproduce. I think it may be collected. If 'timer' is collected, have any logs will be printed? What is the collection mechanism?

GoneGo1ng avatar Jun 22 '21 11:06 GoneGo1ng

if you set the option detached to true it will always keep running and never be collected. If it is falsy (false or nil) then you must make sure you anchor the timer object such that it does not get garbage collected.

It does not add a log statement when it gets collected, that should be a nice addition, a debug-level message.

Tieske avatar Jun 25 '21 08:06 Tieske