1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

fix: concurrency bugs with summary aggregation and user counting

This commit is contained in:
Ferdinand Mütsch
2022-12-01 14:13:52 +01:00
parent aab9e98ebd
commit a4b89d3a69
2 changed files with 6 additions and 4 deletions

View File

@ -63,11 +63,12 @@ func (srv *MiscService) CountTotalTime() {
pendingJobs.Add(len(users))
for _, u := range users {
user := *u
if err := srv.queueWorkers.Dispatch(func() {
defer pendingJobs.Done()
totalTime.Add(srv.countUserTotalTime(u.ID))
totalTime.Add(srv.countUserTotalTime(user.ID))
}); err != nil {
config.Log().Error("failed to enqueue counting job for user '%s'", u.ID)
config.Log().Error("failed to enqueue counting job for user '%s'", user.ID)
pendingJobs.Done()
}
}