Giter Club home page Giter Club logo

Comments (7)

andrewhavens avatar andrewhavens commented on May 23, 2024 2

Well, I figured out why my arguments weren't being passed to my job...it was because I wasn't specifying the args as an array:

# sidekiq.yml

# before (not working):
args: "just a string"

# after (working):
args:
  - "just a string"

@radeno I'm guessing it will work if you pass your hash of args as a single item in an array, like this:

Sidekiq.set_schedule('job_name', 'SomeJob', cron: '* * * * *', args: [{ message_id: 23121, regenerate: true }])

from sidekiq-scheduler.

andrewhavens avatar andrewhavens commented on May 23, 2024

I think I am running into this issue also. I just switched to the new "active job supported configuration syntax" that was added in #80. The admin UI displays that it will pass arguments, but I get errors when the jobs run about missing arguments.

from sidekiq-scheduler.

karmacoma avatar karmacoma commented on May 23, 2024

I also have this same problem. Arguments are not getting passed.

from sidekiq-scheduler.

radeno avatar radeno commented on May 23, 2024

My temporary monkey patch (put into lib directory)

module Sidekiq
  class Scheduler
    # Enqueue a job based on a config hash
    def self.enqueue_job(job_config)
      config = job_config.dup

      config['class'] = config['class'].constantize if config['class'].is_a?(String)
      if config['args'].is_a?(Hash)
        config['args'].symbolize_keys!
      else
        config['args'] = Array(config['args'])
      end

      if defined?(ActiveJob::Enqueuing) && config['class'].included_modules.include?(ActiveJob::Enqueuing)
        config['class'].new(config['args']).enqueue
      else
        Sidekiq::Client.push(config)
      end
    end
  end
end

from sidekiq-scheduler.

karmacoma avatar karmacoma commented on May 23, 2024

@radeno: Thank you! 👍 I will use this for the time being.

from sidekiq-scheduler.

elpic avatar elpic commented on May 23, 2024

Please take a look at the enqueue method it does take some arguments

http://api.rubyonrails.org/classes/ActiveJob/Enqueuing.html#method-i-enqueue

I'm currently working on a fix for this

from sidekiq-scheduler.

elpic avatar elpic commented on May 23, 2024

Already solved on v2.0.5

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.