Fix pendingTasks accounting if TimedRunnable disposed before scheduling#3780
Conversation
chemicL
left a comment
There was a problem hiding this comment.
Great work! Thanks :) Please rebase to target the 3.5.x branch and we can merge.
647eefb to
5736c7f
Compare
|
@chemicL I think I've rebased correctly and targeting 3.5.x branch now as requested. |
|
Thank you for the contribution @kkondratov! Great job and please consider contributing in the future :) 🚀 |
|
Please note the new tests failed when the target branch CI job was run: https://github.com/reactor/reactor-core/actions/runs/8643683792/job/23697225902 I corrected the flakiness of the tests in d11ea71 – please have a look. The tests assumed that active and pending are both equal to 1 when one task is able to run and the other should be waiting. However a situation can happen in which the Runnable is not yet being executed and has not yet decremented the pending counter. |
|
There are other issues of such nature in that test class, e.g. ignoring the result of |
Addresses the issue with TimedScheduler pending task leaks as described in #3697
The chosen approach splits existing TimedRunnable into two implementations and moves code from the TimedScheduler into the TimedRunnable to reduce duplication.
Two implementations
WorkerBacked/SchedulerBackedTimedRunnableare present to differentiate between scheduler or a worker that schedules a task (since there is no shared interface between those).Differentiating from the initial proposed in #3697 by @nathankooij there is no extra objects being created and the scheduling is delegated to TimedRunnable.
Fixes #3697