Closed thomaseizinger closed 1 year ago
Is it not the case that if the user wants to poll another future during the loop of an actor, a single, combined receive-and-tick would prevent this?
Is it not the case that if the user wants to poll another future during the loop of an actor, a single, combined receive-and-tick would prevent this?
I am not advocating for it to be combined. In fact I want to it to be two seperate actions but they should compose well together without the need for xtra::tick
.
Could you give an example on how an API for this could look?
I put up a PR here: #194.
Follow-up from #133.
Currently,
xtra::tick
does two things:(1) is already possible outside of
xtra::tick
by callingMailbox::next
. This is the first code-smell. (2) is a bit more tricky because theMessage
returned byMailbox::next
is an opaque struct for users, they can't do anything with it other than instantiate aTickFuture
.Part of the reason for that is because
MessageEnvelope
andBroadcastEnvelope
return a tuple of the span + the handler future andTickFuture
makes use of that by allowing users to attach to that span.There may be a simpler / more composable way of expressing this by introducing some API on
Message
that makes it obsolete for users to "call back" intoxtra
viaxtra::tick
.