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

feat: email reports (resolve #124)

This commit is contained in:
Ferdinand Mütsch
2021-04-30 14:07:14 +02:00
parent 1beca82875
commit 29c04c3ac5
23 changed files with 913 additions and 468 deletions

View File

@ -16,7 +16,7 @@ const (
aggregateIntervalDays int = 1
)
var lock = sync.Mutex{}
var aggregationLock = sync.Mutex{}
type AggregationService struct {
config *config.Config
@ -157,8 +157,8 @@ func (srv *AggregationService) trigger(jobs chan<- *AggregationJob, userIds map[
}
func (srv *AggregationService) lockUsers(userIds map[string]bool) error {
lock.Lock()
defer lock.Unlock()
aggregationLock.Lock()
defer aggregationLock.Unlock()
for uid := range userIds {
if _, ok := srv.inProgress[uid]; ok {
return errors.New("aggregation already in progress for at least of the request users")
@ -171,8 +171,8 @@ func (srv *AggregationService) lockUsers(userIds map[string]bool) error {
}
func (srv *AggregationService) unlockUsers(userIds map[string]bool) {
lock.Lock()
defer lock.Unlock()
aggregationLock.Lock()
defer aggregationLock.Unlock()
for uid := range userIds {
delete(srv.inProgress, uid)
}