These are chat archives for akkadotnet/akka.net

18th
Aug 2018
Lutando Ngqakaza
@Lutando
Aug 18 2018 14:25
is ReceiveAsync/CommandAsync generally frowned upon to do async await? why was it added as an api then?
this blog is quite millitant about it https://petabridge.com/blog/akkadotnet-async-actors-using-pipeto/
mwardm
@mwardm
Aug 18 2018 19:06
@tinyhydra You don't say what type of database you're talking about but if it's got ACID and transactional characteristics (e.g. a relational database) then trying to do too many things simultaneously causes the issues you're talking about. (Generally, such database lock tables / rows / indexes when they're being updated and sometimes when they're being read. This leads to subsequent updates having to wait; sometimes you bump into deadlocks where (e.g.) 2 threads are each waiting for resources locked by the other one before they can complete their work.) It's normally a bit of an art-form to work out what's going on but ( picking up on your "all in their own actor" comment) I'd suggest that what you don't want to do is be simultaneously running the same kind of work because that's more likely to cause contention. (Apologies if you know all of that!)
Shukhrat Nekbaev
@snekbaev
Aug 18 2018 20:07
@Lutando async versions can simplify the code a bit and also provide actor blocking which might be desired, say for throttling purposes. For UntypedActor I'm using RunTask to do the async/await stuff, it has similar semantics to async/await receive methods in ReceiveActor. @Horusiath is my understanding correct? :)
mwardm
@mwardm
Aug 18 2018 20:34
( @snekbaev @Lutando Not sure if things have moved on from a year ago when I was doing this stuff but I had to make sure to explicitly catch any exception thrown by awaited methods. If it bubbled out of the actor then it brought down the whole actor system.)
Shukhrat Nekbaev
@snekbaev
Aug 18 2018 21:49
@mwardm I really hope they did :)
mwardm
@mwardm
Aug 18 2018 23:01
(Actually, it's possible I'm confused about how I fixed it. I might have had some async void methods in my code and I believe you can't catch exceptions from those properly anyway. It might have been changing the return types on those that sorted things.)