File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Sources/DistributedActors Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -486,7 +486,19 @@ internal final class Mailbox<Message: ActorMessage> {
486486 // MUST be the first check, as we may want to stop immediately (e.g. reacting to system .start a with .stop),
487487 // as other conditions may hold, yet we really are ready to terminate immediately.
488488 traceLog_Mailbox ( shell. path, " Terminating... " )
489- shell. metrics [ gauge: . mailboxCount] ? . record ( status. messageCount - Status( processedActivations) . messageCount)
489+ let processedActivationsCount = Status ( processedActivations) . messageCount
490+ if status. messageCount >= processedActivationsCount {
491+ shell. metrics [ gauge: . mailboxCount] ? . record ( status. messageCount - processedActivationsCount)
492+ } else {
493+ // TODO: Figure out why this can ever happen
494+ shell. log. warning (
495+ " Mailbox closed with more processed activations ( \( processedActivationsCount) ) than messages ( \( status. messageCount) ) " ,
496+ metadata: [
497+ " status " : " \( status) " ,
498+ " processedActivations " : " \( processedActivations) " ,
499+ ]
500+ )
501+ }
490502 return . close
491503 } else if runResult == . closed {
492504 traceLog_Mailbox ( shell. path, " Terminating, completely closed now... " )
You can’t perform that action at this time.
0 commit comments