✅ BackgroundService blocking on Startup
I have a service that spins up a few background services, but when one of them is being started up it is blocking the Host startup and preventing any background services registered later on from starting up.
The gist of what it's doing in the Execute block is this, which is pretty similar to the other services, but whereas where they will return the Task when the host calls StartAsync, this one will continue executing.
Relatively new to working with Background Services, but I can't see where the issue might be 😅
5 Replies
i find it hard to believe that this is blocking startup
either some these services is a
IHostedService instead of a BackgroundService or there's a lock somewhere maybeI can't see a reason why it should be, but it seems tied to this class in particular.
All services are a BackgroundService
behaviour I see in
Host is in this block:
The other two services will call start and then continue, but in the StartAsync call for this service, it will call ExecuteAsync but never make it past it. Seemingly not picking up the task?
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
Okay sorted it, thank you!
You were right about it blocking, I was using async/await in there but everything it awaits is completing synchronously so I guess that's where my issue is cropping up 😅
!close
Closed!