Skip to content

Commit

Permalink
fix race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
lrweck committed Aug 17, 2024
1 parent 76c172a commit f3ded6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cluster/gossiper.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (g *Gossiper) GetActorCount() map[string]int64 {
clusterKinds := g.cluster.GetClusterKinds()
for _, kindName := range clusterKinds {
kind := g.cluster.GetClusterKind(kindName)
m[kindName] = int64(kind.count)
m[kindName] = int64(kind.Count())
}
g.cluster.Logger().Debug("Actor Count", slog.Any("count", m))

Expand Down
4 changes: 4 additions & 0 deletions cluster/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ func (ak *ActivatedKind) Inc() {
func (ak *ActivatedKind) Dec() {
atomic.AddInt32(&ak.count, -1)
}

func (ak *ActivatedKind) Count() int32 {
return atomic.LoadInt32(&ak.count)
}

0 comments on commit f3ded6f

Please sign in to comment.