Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix race condition #1130

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix race condition
  • Loading branch information
lrweck committed Aug 17, 2024
commit f3ded6fd4b95219d1c4382b4fde22c1b2bf8a6f9
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)
}
Loading