Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
rogeralsing committed Apr 6, 2024
1 parent 9cf28e8 commit ea79715
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cluster/identitylookup/disthash/placement_actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ func (p *placementActor) Receive(ctx actor.Context) {

func (p *placementActor) onTerminated(msg *actor.Terminated) {
found, key, meta := p.pidToMeta(msg.Who)
clusterKind := p.cluster.GetClusterKind(meta.ID.Kind)
clusterKind.Dec()

activationTerminated := &clustering.ActivationTerminated{
Pid: msg.Who,
Expand Down Expand Up @@ -98,6 +100,7 @@ func (p *placementActor) onActivationRequest(msg *clustering.ActivationRequest,
props := clustering.WithClusterIdentity(clusterKind.Props, msg.ClusterIdentity)

pid := ctx.SpawnPrefix(props, msg.ClusterIdentity.Identity)
clusterKind.Inc()

p.actors[key] = GrainMeta{
ID: msg.ClusterIdentity,
Expand Down
2 changes: 1 addition & 1 deletion cluster/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ func (ak *ActivatedKind) Inc() {
atomic.AddInt32(&ak.count, 1)
}

func (ak *ActivatedKind) Dev() {
func (ak *ActivatedKind) Dec() {
atomic.AddInt32(&ak.count, -1)
}
7 changes: 6 additions & 1 deletion examples/cluster-gossip/node1/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ func startNode() *cluster.Cluster {

as := &cluster.ActorStatistics{}

fmt.Printf("Member %v\n", msg.MemberID)
if unpackErr := msg.Value.UnmarshalTo(as); unpackErr != nil {
fmt.Printf("\nActorStatistics %v\n\n", as)
//loop over as.ActorCount map
for k, v := range as.ActorCount {
fmt.Printf("ActorCount %v %v\n", k, v)
}

}
}
})
Expand Down

0 comments on commit ea79715

Please sign in to comment.