Loading CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr ### Fixed - Correctly calculate 'can enter' field for newly created tournaments. - Ensure tournament reset callbacks carry the correct ID. - Ensure tournament end callbacks carry the correct end and reset times. ## [2.9.1] - 2020-01-14 ### Changed Loading server/leaderboard_scheduler.go +7 −5 Original line number Diff line number Diff line Loading @@ -284,15 +284,17 @@ func (ls *LocalLeaderboardScheduler) queueEndActiveElapse(t time.Time, ids []str return } ts := t.Unix() tMinusOne := time.Unix(ts-1, 0).UTC() // Immediately schedule the next invocation to avoid any gaps caused by time spent processing below. ls.Update() // Skip processing if there is no tournament end callback registered. if ls.fnTournamentEnd == nil { return } // Immediately schedule the next invocation to avoid any gaps caused by time spent processing below. ls.Update() ts := t.Unix() ls.Lock() if ls.lastEnd != 0 && ls.lastEnd >= ts { // Avoid running duplicate or delayed scheduling. Loading @@ -309,7 +311,7 @@ func (ls *LocalLeaderboardScheduler) queueEndActiveElapse(t time.Time, ids []str for _, id := range ids { currentId := id // Will block if the queue is full. ls.queue <- &LeaderboardSchedulerCallback{id: currentId, ts: ts} ls.queue <- &LeaderboardSchedulerCallback{id: currentId, ts: ts, t: tMinusOne} } }() } Loading server/runtime_lua.go +2 −1 Original line number Diff line number Diff line Loading @@ -1424,7 +1424,7 @@ func (rp *RuntimeProviderLua) TournamentEnd(ctx context.Context, tournament *api luaCtx := NewRuntimeLuaContext(r.vm, r.luaEnv, RuntimeExecutionModeTournamentEnd, nil, 0, "", "", nil, "", "", "") tournamentTable := r.vm.CreateTable(0, 16) tournamentTable := r.vm.CreateTable(0, 17) tournamentTable.RawSetString("id", lua.LString(tournament.Id)) tournamentTable.RawSetString("title", lua.LString(tournament.Title)) Loading @@ -1439,6 +1439,7 @@ func (rp *RuntimeProviderLua) TournamentEnd(ctx context.Context, tournament *api tournamentTable.RawSetString("max_size", lua.LNumber(tournament.MaxSize)) tournamentTable.RawSetString("max_num_score", lua.LNumber(tournament.MaxNumScore)) tournamentTable.RawSetString("duration", lua.LNumber(tournament.Duration)) tournamentTable.RawSetString("start_active", lua.LNumber(tournament.StartActive)) tournamentTable.RawSetString("end_active", lua.LNumber(tournament.EndActive)) tournamentTable.RawSetString("can_enter", lua.LBool(tournament.CanEnter)) tournamentTable.RawSetString("next_reset", lua.LNumber(tournament.NextReset)) Loading Loading
CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr ### Fixed - Correctly calculate 'can enter' field for newly created tournaments. - Ensure tournament reset callbacks carry the correct ID. - Ensure tournament end callbacks carry the correct end and reset times. ## [2.9.1] - 2020-01-14 ### Changed Loading
server/leaderboard_scheduler.go +7 −5 Original line number Diff line number Diff line Loading @@ -284,15 +284,17 @@ func (ls *LocalLeaderboardScheduler) queueEndActiveElapse(t time.Time, ids []str return } ts := t.Unix() tMinusOne := time.Unix(ts-1, 0).UTC() // Immediately schedule the next invocation to avoid any gaps caused by time spent processing below. ls.Update() // Skip processing if there is no tournament end callback registered. if ls.fnTournamentEnd == nil { return } // Immediately schedule the next invocation to avoid any gaps caused by time spent processing below. ls.Update() ts := t.Unix() ls.Lock() if ls.lastEnd != 0 && ls.lastEnd >= ts { // Avoid running duplicate or delayed scheduling. Loading @@ -309,7 +311,7 @@ func (ls *LocalLeaderboardScheduler) queueEndActiveElapse(t time.Time, ids []str for _, id := range ids { currentId := id // Will block if the queue is full. ls.queue <- &LeaderboardSchedulerCallback{id: currentId, ts: ts} ls.queue <- &LeaderboardSchedulerCallback{id: currentId, ts: ts, t: tMinusOne} } }() } Loading
server/runtime_lua.go +2 −1 Original line number Diff line number Diff line Loading @@ -1424,7 +1424,7 @@ func (rp *RuntimeProviderLua) TournamentEnd(ctx context.Context, tournament *api luaCtx := NewRuntimeLuaContext(r.vm, r.luaEnv, RuntimeExecutionModeTournamentEnd, nil, 0, "", "", nil, "", "", "") tournamentTable := r.vm.CreateTable(0, 16) tournamentTable := r.vm.CreateTable(0, 17) tournamentTable.RawSetString("id", lua.LString(tournament.Id)) tournamentTable.RawSetString("title", lua.LString(tournament.Title)) Loading @@ -1439,6 +1439,7 @@ func (rp *RuntimeProviderLua) TournamentEnd(ctx context.Context, tournament *api tournamentTable.RawSetString("max_size", lua.LNumber(tournament.MaxSize)) tournamentTable.RawSetString("max_num_score", lua.LNumber(tournament.MaxNumScore)) tournamentTable.RawSetString("duration", lua.LNumber(tournament.Duration)) tournamentTable.RawSetString("start_active", lua.LNumber(tournament.StartActive)) tournamentTable.RawSetString("end_active", lua.LNumber(tournament.EndActive)) tournamentTable.RawSetString("can_enter", lua.LBool(tournament.CanEnter)) tournamentTable.RawSetString("next_reset", lua.LNumber(tournament.NextReset)) Loading