Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created September 1, 2023 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/7136aaf63f4da8c0d8b1da159a4df1c8 to your computer and use it in GitHub Desktop.
Save bjoerntx/7136aaf63f4da8c0d8b1da159a4df1c8 to your computer and use it in GitHub Desktop.
public async Task DoWork(CancellationToken cancellationToken)
{
while (!cancellationToken.IsCancellationRequested)
{
ProcessingRequest request = new ProcessingRequest(null);
if (request.Id == null)
{
logger.LogInformation("No request found in queue");
await Task.Delay(1000, cancellationToken);
continue;
}
else
{
TextControlProcessing.Merge(request);
logger.LogInformation("Request found - executing worker");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment