Skip to content

Commit

Permalink
Merge pull request #1130 from lrweck/fix/race_condition_kind_count
Browse files Browse the repository at this point in the history
fix race condition
  • Loading branch information
rogeralsing authored Aug 22, 2024
2 parents 76c172a + f3ded6f commit 3c0e61c
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 3c0e61c

Please sign in to comment.