Code Monkey home page Code Monkey logo

Comments (12)

maxrosecollins avatar maxrosecollins commented on May 24, 2024 2

My scheduler.yml file

DailyCheckWorker:
  cron: "0 20 00 * * *"
  class: DailyCheckWorker
  queue: worker
  description: "abcdef"

Then in my sidekiq.rb file

Sidekiq.configure_server do |config|
  config.redis = { size: 126 }
  config.reliable_fetch!
  config.reliable_scheduler!
  puts File.expand_path("../../../config/scheduler.yml",__FILE__)
  config.on(:startup) do
    Sidekiq.schedule = YAML.load_file(File.expand_path("../../../config/scheduler.yml",__FILE__))
  end
end

My worker is as follows

class DailyCheckWorker
  include Sidekiq::Worker

  sidekiq_options queue: :worker

  def perform
    logger.info 'I RAN'
  end
end

I just noticed this when starting the server

19:03:36 worker.1 | 2016-02-29T19:03:36.323Z 14320 TID-ow9xey8l0 INFO: Loading Schedule
19:03:36 worker.1 | 2016-02-29T19:03:36.323Z 14320 TID-ow9xey8l0 INFO: Schedule empty! Set Sidekiq.schedule
19:03:36 worker.1 | 2016-02-29T19:03:36.323Z 14320 TID-ow9xey8l0 INFO: Schedules Loaded

I create my queues in a Procfile

web: bundle exec puma -C config/puma.rb
reports: bundle exec sidekiq -q reports
worker: bundle exec sidekiq -q worker

from sidekiq-scheduler.

maxrosecollins avatar maxrosecollins commented on May 24, 2024

any ideas?

from sidekiq-scheduler.

elpic avatar elpic commented on May 24, 2024

This will run at 00:00 on the 19th of every month. Is that what you want?

from sidekiq-scheduler.

maxrosecollins avatar maxrosecollins commented on May 24, 2024

With 6 options doesn't it mean the first is seconds second is minutes and third is hours? So my understanding was 00:00:19 every day every month every year?

from sidekiq-scheduler.

elpic avatar elpic commented on May 24, 2024

Yes, you are right. Could you add more info about your configuration and the way you load the scheduler?

Thanks

from sidekiq-scheduler.

elpic avatar elpic commented on May 24, 2024

The config startup should be like this:

config.on(:startup) do
  Sidekiq.schedule = YAML.load_file(File.expand_path("../../../config/scheduler.yml",__FILE__))
  Sidekiq::Scheduler.load_schedule! # This will retrigger the loading stage 
end

But you can also avoid this if you add the :schedule: line to you sidekiq.yml like this

:schedule:
  DailyCheckWorker:
    cron: "0 20 00 * * *"
    class: DailyCheckWorker
    queue: worker
    description: "abcdef"

from sidekiq-scheduler.

maxrosecollins avatar maxrosecollins commented on May 24, 2024

Okay, so it is working now. Thank you so much for the help!

but it seems to trigger the job on each queue I have.

On start up it says

20:10:03 reports.1 | 2016-02-29T20:10:03.209Z 18585 TID-owxpvmwow INFO: Scheduling DailyCheckWorker
20:10:03 worker.1  | 2016-02-29T20:10:03.209Z 18587 TID-ove3rirco INFO: Scheduling DailyCheckWorker

from sidekiq-scheduler.

elpic avatar elpic commented on May 24, 2024

Sorry you should use reload_schedule! instead of load_schedule!

from sidekiq-scheduler.

maxrosecollins avatar maxrosecollins commented on May 24, 2024

It still runs the job on each queue I have. Do I need to load different sidekiq configs into my queues? As each of them is actually a separate instance of sidekiq running? If I am not mistaken?
For example...

web: bundle exec puma -C config/puma.rb
reports: bundle exec sidekiq -q reports -C ./config/sidekiqconfig.rb
worker: bundle exec sidekiq -q worker -C ./config/differentsidekiqconfig.rb

from sidekiq-scheduler.

maxrosecollins avatar maxrosecollins commented on May 24, 2024

Sorry I didn't mean to close the issue.

I'm still having the issue of the job running on each queue. If I add more queues it runs more often.

from sidekiq-scheduler.

elpic avatar elpic commented on May 24, 2024

Is this related with this issue? Because I thought that this issue was related with the fact that the jobs was not running.

from sidekiq-scheduler.

maxrosecollins avatar maxrosecollins commented on May 24, 2024

Okay I will open a new issue that reflects the new problem

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.