fix: clear summary cache on new project label (resolve #369)

This commit is contained in:
Ferdinand Mütsch 2022-05-07 09:37:10 +02:00
parent 74a5226e73
commit a76db3e95f
1 changed files with 1 additions and 7 deletions

View File

@ -2,7 +2,6 @@ package services
import (
"errors"
"fmt"
"github.com/duke-git/lancet/v2/datetime"
"github.com/emvi/logbuch"
"github.com/leandro-lugaresi/hub"
@ -41,12 +40,7 @@ func NewSummaryService(summaryRepo repositories.ISummaryRepository, durationServ
sub1 := srv.eventBus.Subscribe(0, config.TopicProjectLabel)
go func(sub *hub.Subscription) {
for m := range sub.Receiver {
userId := m.Fields[config.FieldUserId].(string)
for key := range srv.cache.Items() {
if strings.HasSuffix(key, fmt.Sprintf("__%s__--aliased", userId)) {
srv.cache.Delete(key)
}
}
srv.invalidateUserCache(m.Fields[config.FieldUserId].(string))
}
}(&sub1)