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

ScheduledRunnable to honor interrupt settings from Schedulers.from usage #7745

Conversation

akarnokd
Copy link
Member

When using Schedulers.from and running a delayed task via schedule(Runnable, long, TimeUnit), the ExecutorScheduler uses the standard ScheduledRunnable infrastructure for the initial delay.

When the task is disposed during this initial delay, the cancellation always triggers with an interrupted on inside ScheduledRunnable as it is not aware the Schedulers.from may run in no-interrupt mode.

When the dispose happens after the delay, during the actual task's runtime, the no-interrupt mode is honored as expected (as ScheduledRunnable is no longer involved).

This PR adds an interruptOnCancel flag to ScheduledRunnable, an overloaded constructor to minimize the change impact and several tests that check for the aforementioned situations.

Resolves #7744

@akarnokd akarnokd added this to the 3.1-support milestone Aug 10, 2024
Copy link

codecov bot commented Aug 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.63%. Comparing base (9b55d01) to head (a92417d).
Report is 76 commits behind head on 3.x.

Additional details and impacted files
@@            Coverage Diff            @@
##                3.x    #7745   +/-   ##
=========================================
  Coverage     99.62%   99.63%           
- Complexity     6801     6803    +2     
=========================================
  Files           752      752           
  Lines         47707    47710    +3     
  Branches       6401     6402    +1     
=========================================
+ Hits          47527    47534    +7     
+ Misses           84       79    -5     
- Partials         96       97    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@akarnokd akarnokd merged commit 148378c into ReactiveX:3.x Aug 10, 2024
5 checks passed
@akarnokd akarnokd deleted the ExecutorScheduler_ScheduledRunnable_PreDelay_Interrupt_Fix branch August 10, 2024 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[3.x] ScheduledRunnable does not respect ExecutorScheduler.interruptibleWorker
3 participants