Closed colinyip closed 8 years ago
What is your use case, or more precisely: why do you need to call strand-blocking blocking operations like call
from event handlers?
@colinyip Asking because at present handlers are not suspendable in order to keep the events actor "reactive" (disallow handlers to block each other) but Quasar docs seem to suggest otherwise, so there's definitely something to do for us: either remove this restriction or change the docs.
Your use case can help us decide which route to take. Thanks!
@circlespainter thanks for the reply! In my case, the handler i created need to process some task that relies on the state of another actor, so it need to make a strand-blocking call to fetch the data before it could finish executing. I realised later on that wrapping the whole handler logic in a fiber actually works a bit better because it allows multiple event handling happen in parallel, which suits better in for the feature i am working.
So this is not something must have for me. But in my opinion, I would vote for having the restriction removed. It's more consistent with the Quasar docs (according to your comments) and It should be up to the user how they want it to work :) Or perhaps update the doc so that people are aware of this behavior?
Thanks!
It is now discouraged but supported. Thanks for your feedback!
thanks 👍
Not sure this is an issue or i am just using it in a wrong way, would be great to clarify this :)
Whenever i execute
call!
inside a handler ofgen-event
(EventSourceActor), it throws a NullPointerException atco.paralleluniverse.strands.Strand park
for example:
Exceptions:
the way i dealt with it at the moment is wrapping the whole handler logic in a fiber and it works pretty well :)
Thanks!