AK1000: warn users about using ReceiveAsync
when not actually doing any await
-ing
#57
Labels
AK1000
Actor design rules.
Is your feature request related to a problem? Please describe.
From the submission on #55
Using
ReceiveAsync
this way is less performant than a normalReceive
because this generates an extraActorTask
message plus an additional suspend + resume of the actor's mailbox. That overhead is fine if you'reawait
-ing something, but if the code is essentially synchronous then we should not do so.Describe the solution you'd like
Issue a
WARNING
level severity here and a code fix to rewrite theReceiveAsync
to a regularReceive
if theReceiveAsync
doesn't actually have anyawait
s happening inside of it.Additional context
If the user is invoking a declared method as the
ReceiveAsync
handler instead of an anonymous delegate, that might be a lot trickier to analyze correctly as the method can get used across multiple callsites. Maybe it's best to skip doing that for now.The text was updated successfully, but these errors were encountered: