Skip to content
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

Are async handlers waited? #110

Open
bdongus opened this issue May 19, 2022 · 1 comment
Open

Are async handlers waited? #110

bdongus opened this issue May 19, 2022 · 1 comment

Comments

@bdongus
Copy link

bdongus commented May 19, 2022

I have the following event handler:

		public Task Handle(ProductCreated message, CancellationToken token = default) {
			if (message is not null) {
				_productUnitOfWork.ProductRepository.Add(new Product(message.Id, message.Name, message.Description));
				return _productUnitOfWork.SaveChangesAsync(token);
			}
			return Task.CompletedTask;
		}

My UI sometimes isn't updated. It seems your library isn't awaiting the returned Task. InvokeHandler in RouteRegistrar at least isn't.
Am I on the wrong path or is this something you can help me fixing it?

@gautema
Copy link
Owner

gautema commented Aug 9, 2022

Hi. It's a bit hard to tell without seeing more of your code, I've tried reproducing your error but can't find any problems with async code and when I try to do something that takes time in a handler, its seems to be awaited. The RouteRegistrar-code is unfortunately very complex and its been 5 years or so since I touched it last, so its I don't have complete control at the moment, but can't trigger your bug. If you could make me a test or something similar that fails that would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants