mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: clear summary cache on new project label (resolve #369)
This commit is contained in:
parent
74a5226e73
commit
a76db3e95f
@ -2,7 +2,6 @@ package services
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"github.com/duke-git/lancet/v2/datetime"
|
"github.com/duke-git/lancet/v2/datetime"
|
||||||
"github.com/emvi/logbuch"
|
"github.com/emvi/logbuch"
|
||||||
"github.com/leandro-lugaresi/hub"
|
"github.com/leandro-lugaresi/hub"
|
||||||
@ -41,12 +40,7 @@ func NewSummaryService(summaryRepo repositories.ISummaryRepository, durationServ
|
|||||||
sub1 := srv.eventBus.Subscribe(0, config.TopicProjectLabel)
|
sub1 := srv.eventBus.Subscribe(0, config.TopicProjectLabel)
|
||||||
go func(sub *hub.Subscription) {
|
go func(sub *hub.Subscription) {
|
||||||
for m := range sub.Receiver {
|
for m := range sub.Receiver {
|
||||||
userId := m.Fields[config.FieldUserId].(string)
|
srv.invalidateUserCache(m.Fields[config.FieldUserId].(string))
|
||||||
for key := range srv.cache.Items() {
|
|
||||||
if strings.HasSuffix(key, fmt.Sprintf("__%s__--aliased", userId)) {
|
|
||||||
srv.cache.Delete(key)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}(&sub1)
|
}(&sub1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user