-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
I'm expecting events behavior from PubSub, i.e. if I publish an event, somebody will catch it eventually (or not) and do what needs to be done. I was really surprised that it waits for all handlers to finish, i.e. Publish won't return until all handlers are done.
PubSub.Hub.Default.Subscribe<MyObj>(async c =>
{
await Task.Delay(TimeSpan.FromSeconds(10));
});
await PubSub.Hub.Default.PublishAsync(new MyObj());
var t = 1; // We reach this line only after the delay func is finished, i.e. in 10 seconds.
I would excpect that the above code behaves like this:
PubSub.Hub.Default.Subscribe<MyObj>(c =>
{
_ = Task.Run(async () => await Task.Delay(TimeSpan.FromSeconds(10)));
});
await PubSub.Hub.Default.PublishAsync(new MyObj());
var t = 1; // We reach this line immideatelly. Handler task will be finished at some point in time.
PandaWood
Metadata
Metadata
Assignees
Labels
No labels