Fix for Negative Repeat Count in Scheduler (#101) (#146)

* Comment out decrement of s.repeats in scheduler to fix negative repeat count issue

* Fix repeat count handling in scheduler

- Reset `repeats` to -1 for values less than -1
- Decrement `repeats` by 1 if it's greater than 0
This commit is contained in:
Tobias Menzel
2023-12-14 14:44:07 +01:00
committed by GitHub
parent 098aa66a2d
commit 13a382cca2

View File

@@ -82,7 +82,15 @@ def scheduler(broker: Broker = None):
break
s.next_run = next_run
s.repeats += -1
# Little Fix for already broken numbers
if s.repeats < -1:
s.repeats = -1
# Check if the value is not zero
if s.repeats > 0:
s.repeats -= 1
# send it to the cluster; any cluster name is allowed in multi-queue scenarios
# because `broker_name` is confusing, using `cluster` name is recommended and takes precedence
q_options["cluster"] = s.cluster or q_options.get(