79145613

Date: 2024-10-31 16:53:33
Score: 1
Natty:
Report link
  1. CancellationToken in ExecuteAsync will be triggered once your service gets shut down by the host, like when the entire app gets shuts down (usually gracefully). See BackgroundService base class
  2. Proper cancellation would be either via IHostApplicationLifetime(stops the entire app) or add CancellationTokenSource into the IoC container, resolve it in the service's constructor, and create a linked token source to monitor the cancellation signal in ExecutAsync
Reasons:
  • No code block (0.5):
  • Starts with a question (0.5): Can
Posted by: Kiryl