-
Notifications
You must be signed in to change notification settings - Fork 237
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
Running a 2nd sidekiq process will overwrite schedule configuration stored in Redis #361
Comments
schedule
in Redis
schedule
in Redis
I would say that this is just not a supported feature by sidekiq-scheduler and not a bug. Why do you need to run one process with the schedule and the other one not? |
Hi @marcelolx 👋 Thanks for the speedy reply! There are scenarios where, like those hinted at in the Sidekiq Wiki, a service or set of services might have a handful of sidekiq processes for handling different queues. Only one configuration may be the definitive source of the "schedule" and its setup. This issue arises when those Sidekiq process share the same Redis instances (which again, I feel is a some what normal practice when using Sidekiq). It feels redundant to have every configuration define the same schedule, it become very hard to do so if, for instance, the sidekiq processes in question do not share the same codebase but share the same redis infrastructure. |
Also, just to note in the contrived example I have, I know that if the second configuration had :concurrency: 5
:queues:
- scheduler
- other
## Scheduler setup Configuration
:enabled: false # prevent sidekiq-scheduler from trying to load an empty `schedule` I think, since that "solves" this specific example, it's probably fine. Maybe, if anything, we can consider that if |
@wspurgin Particularly I would prefer to keep it explicit, this way who is gonna look at the config file will know that the scheduler is disabled (with dynamic schedules it would/could start disabled and then we would have to enable it when the schedule changes). Also what I think that could help would be using https://github.com/resque/redis-namespace, this way each "schedule" would be namespaces and they wouldn't override, but I think disabling the schedule is way easier. |
👍 Heard on the explicit enabled/disable flag. Maybe just a documentation enhancement then (again, if anything) Namespaces would also solve this specific issue... but that would mean all of Sidekiq is namespaced which might not be as desirable. Disabling is definitely the easiest thing to do. |
@wspurgin Documentation enhancements are welcome! If you can add the scenario described above I'll be happy to merge! (and anything else you consider valuable) Yeah, disabling definitely is the easiest solution |
Thanks @marcelolx 👍 Opened #362 for it 😄 Let me know what you think. |
Hmm, quick question: the key is Also, would you run into this issue if using a different file for the schedule? I'm thinking not since in that case each process would load it from the same file, but wanted to double-check. https://github.com/sidekiq-scheduler/sidekiq-scheduler#load-the-schedule-from-a-different-file Thanks! |
@ibrahima Yes, it is at the root level. In this PR #412 we're going to move it to the Yes, it will because the issue is the |
Ah yeah that makes sense re: the "root" key. So just to confirm: If I am loading the Sidekiq-scheduler config from a different file, all of my Sidekiq processes will have the same sidekiq-scheduler config, even if they have different Sidekiq configs. This is different from some processes having a config defined and some having |
I've noticed that, if one runs a 2nd sidekiq process with a separate configuration, the recurring jobs tab gets emptied out in the web extension.
Please note that the schedule itself with rufus still continues to operate and queue the scheduled jobs on the correct intervals.
I believe this might be the cause of #293
Setup
Run a rails app with Sidekiq and
sidekiq-scheduler
. Mount theSidekiq::Web
UI with thesidekiq-scheduler/web
required.Include a
config/sidekiq.yml
with a configured schedule, e.g.,Next create another sidekiq configuration, this time without a schedule:
Steps to reproduce
This bug is order dependent, if the process with the schedule boots last, the Recurring Jobs tab will show the schedule.
I made a reproducible app here: https://github.com/wspurgin/vanilla/tree/sidekiq-scheduler
Hypothesis
I believe it has to do with how the schedule is stored. Namely, that the key used to store and retrieve the schedules is just
schedules
and not namespaced to the booted Sidekiq process (e.g., bypid
or full process name). Therefore the last booted sidkeiq process' "schedule" configuration wins out.The text was updated successfully, but these errors were encountered: