Closed bschwind closed 2 years ago
I'm kind of hesistant to support unbounded actor addresses, since it opens up the possibility for unbounded memory consumption and might lead to issues that are more difficult to track down compared to errors that can be caught within the binary.
I don't share those same concerns. In the same way that crossbeam-channel
provides unbounded
and it's up to you to use it responsibly, why can't this crate provide the same?
The problem we want to solve is "This actor is not on the 'hot path' of my application. I want it to receive every message it gets sent, even if it takes a little longer or uses up some memory."
That's why we have some actors with an addr of Addr::with_capacity(500)
. It's kind of silly to just take a random guess at what that value should be if your intention is for it to never drop messages. I'm talking about actors which handle state/config changes which don't happen at a regular frequency but which may have some burstiness to it.
@bschwind I'm closing this PR for now.
In some cases we create actors with "large enough" buffers, like
500
or so. In these cases, instead of just guessing the capacity, it probably makes more sense to just use an unbounded channel. The500
was essentially saying "we should have enough where it never reaches capacity", and I think usingunbounded
makes that distinction more clear.