Skip to content

Commit

Permalink
mailbox worker to write directly to receiveC if there is space in buf…
Browse files Browse the repository at this point in the history
…fer (#64)
  • Loading branch information
vladopajic authored Nov 15, 2023
1 parent 719c583 commit 58821e9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion actor/mailbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,12 @@ func (w *mailboxWorker[T]) DoWork(c Context) WorkerStatus {
return WorkerEnd

case value := <-w.sendC:
w.queue.PushBack(value)
if len(w.receiveC) < mbxChanBufferCap {
w.receiveC <- value
} else {
w.queue.PushBack(value)
}

return WorkerContinue
}
}
Expand Down

0 comments on commit 58821e9

Please sign in to comment.