Skip to content

Unique args in combination with sidekiq cron contains _aj_symbol_keys #363

@Laykou

Description

@Laykou

Describe the bug
When used together with sidekiq-cron, the hashes may include _aj_symbol_keys keys which then confuses unique_arg method.

Expected behavior
The job to be executed.

Current behavior
The job was created. I can see the unique digest is created and also sidekiq-status creates initial record in Redis, BUT the job is NOT executed.

The unique digest is not removed however no job is running and it looks like nothing else happened.

Worker class

class MyWorker
  include Sidekiq::Worker
  include Sidekiq::Status::Worker

  sidekiq_options retry: 0, lock: :until_executed, lock_expiration: 15.minutes.to_i, queue: :system_schedulers

  def self.unique_args(args)
    # Here I've noticed that the there is `args.first['params']['_aj_symbol_keys']`
    args
  end

  def perform(args)
    # args['sleep'] == '10'
    # args['params'] == { foo1: 'bar1', foo2: 'bar2' }
  end
end

Additional context

# schedule.yml

my_worker:
    cron: "* * * * *"
    class: "MyWorker"
    args:
      sleeps: "10"
      params:
        foo1: "bar1"
        foo2: "bar2"

I think unique_jobs should try to ActiveJob::Arguments.deserialize args before using them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions