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> {
486
486
// MUST be the first check, as we may want to stop immediately (e.g. reacting to system .start a with .stop),
487
487
// as other conditions may hold, yet we really are ready to terminate immediately.
488
488
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
+ }
490
502
return . close
491
503
} else if runResult == . closed {
492
504
traceLog_Mailbox ( shell. path, " Terminating, completely closed now... " )
You can’t perform that action at this time.
0 commit comments