fix: call ret:emit_signal("timeout") instead of args.callback (#3933)

This ensures that the timer gets passed on the first call of callback.
fixes: #3904

Signed-off-by: aarondill <aaronsacks2006@gmail.com>
This commit is contained in:
Aaron Dill 2024-08-18 07:20:19 -05:00 committed by GitHub
parent ad0290bc1a
commit 220ae797e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 4 deletions

View File

@ -205,12 +205,11 @@ function timer.new(args)
end
if args.callback then
if args.call_now then
args.callback()
end
ret:connect_signal("timeout", args.callback)
end
if args.call_now then
ret:emit_signal("timeout")
end
if args.single_shot then
ret:connect_signal("timeout", function() ret:stop() end)
end