Code Monkey home page Code Monkey logo

Comments (10)

adrian-gomez avatar adrian-gomez commented on May 24, 2024

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?

from sidekiq-scheduler.

shedd avatar shedd commented on May 24, 2024

@adrian-gomez awesome, thanks. would appreciate any pointers.

I'm using the latest - v1.0.

from sidekiq-scheduler.

adrian-gomez avatar adrian-gomez commented on May 24, 2024

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.

from sidekiq-scheduler.

shedd avatar shedd commented on May 24, 2024

@adrian-gomez I was able to confirm that I just print out Sidekiq.scheduler into a view and then fire up bundle exec rails s, then change the schedule, restart bundle exec rails s, the output of the view does change. So yes, it does appear to be the console.

from sidekiq-scheduler.

adrian-gomez avatar adrian-gomez commented on May 24, 2024

There also seems like modifying the initializer (config/initializers/sidekiq_scheduler.rb) causes the schedule to reload :S

This is really strange.

from sidekiq-scheduler.

shedd avatar shedd commented on May 24, 2024

@adrian-gomez I think it's the Rails spring preloader.

vagrant@precise64:/vagrant$ spring status
Spring is not running.
vagrant@precise64:/vagrant$ rails c
Loading development environment (Rails 4.1.4)
[1] pry(main)> puts Sidekiq.schedule
{"queue_delayed_order_notifications"=>{"every"=>["1m"], "class"=>"DelayedOrderNotifications", "description"=>"This job looks for delayed orders and triggers the appropriate notifications"}}
=> nil
[2] pry(main)> exit
vagrant@precise64:/vagrant$ spring status
Spring is running:

 4759 spring server | vagrant | started 25 secs ago
 4763 spring app    | vagrant | started 25 secs ago | development mode                
vagrant@precise64:/vagrant$ spring stop
Spring stopped.


[ Change the schedule from 1m to 1h ]


vagrant@precise64:/vagrant$ rails c
Loading development environment (Rails 4.1.4)
[1] pry(main)> puts Sidekiq.schedule
{"queue_delayed_order_notifications"=>{"every"=>["1h"], "class"=>"DelayedOrderNotifications", "description"=>"This job looks for delayed orders and triggers the appropriate notifications"}}
=> nil

By manually stopping Spring, it seems to work.

from sidekiq-scheduler.

adrian-gomez avatar adrian-gomez commented on May 24, 2024

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.

from sidekiq-scheduler.

shedd avatar shedd commented on May 24, 2024

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.

from sidekiq-scheduler.

adrian-gomez avatar adrian-gomez commented on May 24, 2024

I'll great if you could add that comment to in the README :D

from sidekiq-scheduler.

shedd avatar shedd commented on May 24, 2024

PR submitted :)

from sidekiq-scheduler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.