-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PublishAsync is not truly async #16
Comments
Hi, thanks for your kind words and feedback. I am currently looking at the code in terms of getting it running on the dnx core framework - I'll also have a look at the place you mention, see if there is something weird about it. |
Okay, so I've been looking at this ... http://stackoverflow.com/questions/13489065/best-practice-to-call-configureawait-for-all-server-side-code and from what I understand, it seems normal that async/await will hit the worker thread pool. Am I missing something? |
Hi flq, By using Task.Run() we are "taking" threads from the threadpool thus from the users. we want to use the Push mehod to return task and in the SequentialXXX class should call PushAsync and the user of the library to use await. you can test it in the subscibe method use await like so :
|
did this get resolved? |
Nope, as I don’t know what the resolution is. |
What is the intended async flow? Of course there is the publish async but there doesn't seem to be a flow for making an async subscriber? And by merit of the way Action seems to be used. It seems like maybe there needs to be an explicit flow for Action<T, Task>. |
@flq looking at the source it appears async is only partially implemented? Did this not get finished or am I missunderstanding there? It looks like 'IAsyncPublishingPipelineMember' isn't really used anywhere. And the BlockingParrallelPublish doesn't use async methods. |
How would you feel about collaborating to get async working? :) |
Indeed, async was quite an afterthought to have a possibility to await the execution of a publish Operation. The trouble I have with this lib: I have no use case for it anymore. I found it super-helpful in building rich clients, but have done a lot of web dev in the past years, so poor MemBus has been neglected somewhat (Somebody even published a MemBus-reborn to get targetting right). However, if you have concrete ideas, maybe we can invest some time. |
I'd be super happy to loop you in on how we're using membus! I think you can see below the like TL;DR of how we're using membus though. I'd be super happy to work with you on a solution as well if that's helpful!
|
In short the solution to my problem and the orginal posted would be for there to be a path where TaskFactory/Task.Run() isn't used. It simply sequentially calls await and follows and async flow through each subscriber. I.E no step along the way through the membus, not the final subscribed method is a non async method and all must also return Task. Perhaps Task although that isn't within my use case :) |
It's also worth noting none of the other configurations are working correctly in this case. And if I understand correctly. The parrallel blocking publisher should. (Which is the one used by RichClientFrontend configuration) |
So I suppose we’re talking about a deviation from the current behavior and introducing a fully async pipeline? |
Yes indeed :) |
@flq that would exactly be it actually yes. Looking at it there is already a partially complete async pipeline? |
A further alternative would be some of the private fields could be made protected and this would make it easier to build this myself with just inherited classes and new configurations. |
I think it’d be cool if the solution is in MemBus, so anybody in need of an async flow can use this. We could do some kind of skype / hangout to flesh out some details and then go for it. |
This issue will be closed in favour of #27 , which will track progress on adding a fully async pipeline to MemBus for the Milestone release 4.2. |
Hello flq,
Firstly I like to say that I think that your implementation is quite remarkable and very extendable, things that needed in today development world.
I’ve been playing with Membus trying it out and i think that the PublishAync method lack the full power of async await. By using it with an async action it not really "waiting" for the task result so by using Membus on a web server Membus actually consume worker threads.
The issue is in the SequentialPipeline at the LookAtAsync it calls the push method without waiting for it (and using Task.Run() which schedule tasks).
WDYT?
The text was updated successfully, but these errors were encountered: