When I create a tournament without a reset schedule and a start and end time, my tournament end callback is executed at the appropriate time (for debugging purposes, I set the end time to +3sec from the start time). However, if I create a tournament with a reset schedule (resetting daily at midnight), a start time and a duration of 3 seconds, but no end time, my tournament end callback is scheduled to execute 3 seconds after the reset time.
My understanding is that the tournament end callback is supposed to execute when the duration from the start time expires, which should be 3 seconds after the start of the tournament in this test case (this seems necessary to reward the winners of the tournament). Why is it scheduling the callback to execute 3 seconds after the reset time instead?
Below are my two test cases. All other code remains the same.
In this following example, the tournament end callback gets executed, but it does not use a reset schedule:
local reset = ""
local duration = 3
local start_time = nakama.time() / 1000
local end_time = start_time + duration
nakama | {"level":"debug","ts":"2020-11-14T08:10:42.080Z","caller":"server/leaderboard_scheduler.go:265","msg":"Setting timer to run end active function","end_active":"2.9191259s","ids":["4ec4f126-3f9d-11e7-84ef-b7c182b36521"]}
nakama | {"level":"debug","ts":"2020-11-14T08:10:42.080Z","caller":"server/leaderboard_scheduler.go:271","msg":"Setting timer to run expiry function","expiry":"2.9191259s","ids":["4ec4f126-3f9d-11e7-84ef-b7c182b36521"]}
nakama | {"level":"info","ts":"2020-11-14T08:10:42.080Z","caller":"server/leaderboard_scheduler.go:278","msg":"Leaderboard scheduler update","end_active":"2.9191259s","end_active_count":1,"expiry":"2.9191259s","expiry_count":1}
And in the next example below, the tournament end callback does not get called within the ~3 seconds. The output says that it is being scheduled 15 hours and change later, which is when the reset is scheduled to occur. The tournament end callback never gets called.
local reset = "0 0 * * *"
local duration = 3
local start_time = nakama.time() / 1000
local end_time = 0
nakama | {"level":"debug","ts":"2020-11-14T08:06:41.485Z","caller":"server/leaderboard_scheduler.go:265","msg":"Setting timer to run end active function","end_active":"15h53m21.5147s","ids":["4ec4f126-3f9d-11e7-84ef-b7c182b36521"]}
nakama | {"level":"debug","ts":"2020-11-14T08:06:41.485Z","caller":"server/leaderboard_scheduler.go:271","msg":"Setting timer to run expiry function","expiry":"39h53m18.5147s","ids":["4ec4f126-3f9d-11e7-84ef-b7c182b36521"]}
nakama | {"level":"info","ts":"2020-11-14T08:06:41.485Z","caller":"server/leaderboard_scheduler.go:278","msg":"Leaderboard scheduler update","end_active":"15h53m21.5147s","end_active_count":1,"expiry":"39h53m18.5147s","expiry_count":1}
I am looking for a solution that allows me to define a reset schedule but also execute the tournament end callback so that I can properly distribute rewards to the winning players. How can I achieve the functionality of the first example while using a reset schedule like in the second example above?