-
Notifications
You must be signed in to change notification settings - Fork 238
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
Schedule not being reloaded when starting Rails app #35
Comments
The schedule should we reloaded fresh everytime you start your app, ill try to reproduce this and comment back. What version of sidekiq-scheduler are you using? |
@adrian-gomez awesome, thanks. would appreciate any pointers. I'm using the latest - v1.0. |
I'm seeing the same issue but only with the rails console, if i start the server or sidekiq the schedules are loaded properly. Can you confirm this? I'll look into this issue to find out what is causing this behavior. |
@adrian-gomez I was able to confirm that I just print out |
There also seems like modifying the initializer (config/initializers/sidekiq_scheduler.rb) causes the schedule to reload :S This is really strange. |
@adrian-gomez I think it's the Rails spring preloader.
By manually stopping Spring, it seems to work. |
Ok i'll close this issue if you are ok with it. I haven't looked into spring at all, maybe there is a workaround for this that i'm not aware of. |
Sure, I'm fine with closing this now that I understand what's going on. Apparently, Spring reloads the initializers if they are changed, but not if they are unmodified, so that's what's happening. It appears to be possible to tell Spring to do things before loading: https://github.com/rails/spring#running-code-before-forking So this could potentially be used to clean this up. It might be worth putting a note in the README about this, in case anyone else encounters this. |
I'll great if you could add that comment to in the README :D |
PR submitted :) |
I'm seeing an issue where restarting the Rails app does not reload the schedule.
Following the README example, I have an initializer that loads
config/schedule.yml
If the following is my
schedule.yml
It loads fine:
However, if I change the schedule - so changing from
1m
to1h
:Then I reload Rails:
The schedule has not changed. It's still
1m
in Sidekiq, even though I've completely reloaded the app.In fact, in my Vagrant development environment, the only thing that I found to reload the schedule is actually to reboot the VM.
Is this expected? I've used Resque scheduler before, so I'm expecting behavior similar to that - with Resque scheduler, the schedule was loaded fresh every time the Rails app was restarted.
The text was updated successfully, but these errors were encountered: