Skip to content

Prevent scheduled task cancelation from emitting error logs#1758

Merged
rogeralsing merged 1 commit intoasynkron:devfrom
jstnlef:safetask-ignore-cancellation
Sep 23, 2022
Merged

Prevent scheduled task cancelation from emitting error logs#1758
rogeralsing merged 1 commit intoasynkron:devfrom
jstnlef:safetask-ignore-cancellation

Conversation

@jstnlef
Copy link
Contributor

@jstnlef jstnlef commented Sep 19, 2022

Description

When trying to cancel scheduled tasks with their corresponding CancelationSource, I noticed error logs were constantly being emitted. The root cause of this turned out to be that the inner Task.Delay ends up being the task that is canceled rather than the outer Task.run so it would always throw an exception. I'm fairly convinced that it isn't necessary to check since no caller could possibly have access to the running task to catch the cancelation exception anyway.

Purpose

This pull request is a:

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@CLAassistant
Copy link

CLAassistant commented Sep 19, 2022

CLA assistant check
All committers have signed the CLA.

@rogeralsing rogeralsing merged commit fb5d36b into asynkron:dev Sep 23, 2022
@jstnlef jstnlef deleted the safetask-ignore-cancellation branch September 23, 2022 18:58
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

Successfully merging this pull request may close these issues.

3 participants

Comments