Skip to content

Commit 2ef186f

Browse files
authored
Force-reload SidekiqScheduler when dynamic schedules are disabled (#32)
* Force-reload the SidekiqScheduler schedule When running with dynamic:false, SidekiqScheduler supposedly allows a manual reload of the scheduler after a `set_schedule` with a single reload command; but that command just re-applies the schedule currently in memory, not the schedule in Redis modified by `set_schedule`. Load the schedule from Redis into memory before re-applying it to get the heartbeat to actually initialize properly. * Bump patch version for prompt release
1 parent a97aa19 commit 2ef186f

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
### Changed
1010

11+
## [2.0.0] - 2025-06-25
12+
13+
### Fixed
14+
- Properly installs the QueueBus heartbeat when SidekiqSchedule is not run in dynamic mode.
15+
1116
## [2.0.0] - 2025-06-17
1217

1318
- [BREAKING] Sidekiq major version now targets 7.X

lib/sidekiq_bus/adapter.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,13 @@ def set_schedule(queue_name)
6767
)
6868

6969
# If dynamic is enabled, this will propagate through a different mechanism
70-
SidekiqScheduler::Scheduler.instance.reload_schedule! unless ::Sidekiq::Scheduler.instance.dynamic
70+
unless ::Sidekiq::Scheduler.instance.dynamic
71+
# despite the docs for SidekiqScheduler, the above entry doesn't hit the memory store until we reload from
72+
# the redis store:
73+
::Sidekiq.reload_schedule!
74+
# this then allows the updated schedule to be applied:
75+
SidekiqScheduler::Scheduler.instance.reload_schedule!
76+
end
7177
end
7278
end
7379
end

lib/sidekiq_bus/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module SidekiqBus
4-
VERSION = '2.0.0'
4+
VERSION = '2.0.1'
55
end

0 commit comments

Comments
 (0)