We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a83f650 commit 45d8d5cCopy full SHA for 45d8d5c
actor/mailbox.go
@@ -297,6 +297,11 @@ func (w *mailboxWorker[T]) DoWork(ctx Context) WorkerStatus {
297
}
298
299
func (w *mailboxWorker[T]) OnStop() {
300
+ // close receiveC, after receiving all data,
301
+ // so everyone reading from this mailbox can be
302
+ // notified that no more messages will ever be received.
303
+ defer close(w.receiveC)
304
+
305
// receiveC channel needs to receive all data before closing
306
if w.options.StopAfterReceivingAll {
307
// first: receive data from queue
@@ -315,6 +320,4 @@ func (w *mailboxWorker[T]) OnStop() {
315
320
316
321
317
322
318
-
319
- close(w.receiveC)
323
0 commit comments