Skip to content
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

Active Job #102

Closed
rafaellima opened this issue Aug 10, 2015 · 7 comments
Closed

Active Job #102

rafaellima opened this issue Aug 10, 2015 · 7 comments

Comments

@rafaellima
Copy link

I have been digging around with Active Job and I have had a hard time trying to find out how to use unique jobs with Active Job. The documentation on https://github.com/mhenrixon/sidekiq-unique-jobs#usage-with-activejob is not clear enough (not for me) and I haven't figured out how does this works.

There is no documentation outside this github page that explains this integration.

This in my config/initializers/sidekiq.rb

Sidekiq.default_worker_options = {
   'unique' => true,
   'unique_args' => proc do |args|
     [args.first.except('job_id')]
   end
}
SidekiqUniqueJobs.config.unique_args_enabled = true

Can someone explain what job_id means?

After adding it I'm still able to enqueue the same worker with the same parameters:

ExampleJob.perform_later(1)
Enqueued ExampleJob (Job ID: 5f18d0bb-4b2c-4a69-9056-688ec2ddd469) to Sidekiq(default) with arguments: 1
=> #<ExampleJob:0x007ff56dcef170 @arguments=[1], @job_id="5f18d0bb-4b2c-4a69-9056-688ec2ddd469", @queue_name="default">

ExampleJob.perform_later(1)
Enqueued ExampleJob (Job ID: 6155c416-9f6b-4620-aae4-080169fbda1a) to Sidekiq(default) with arguments: 1
=> #<ExampleJob:0x007ff56dcef170 @arguments=[1], @job_id="6155c416-9f6b-4620-aae4-080169fbda1a", @queue_name="default">

What am I doing wrong?

@guivinicius
Copy link

Same problem here. Anyone ?

@mhenrixon
Copy link
Owner

Note that more advanced Sidekiq features (sidekiq_options) cannot be controlled or configured via ActiveJob, e.g. saving backtraces.

Meaning don't use active job if you need such functionality :)

@mhenrixon mhenrixon reopened this Aug 11, 2015
@guivinicius
Copy link

@rafaellima

Actually, the code is working. The problem is that when you call perform_later on localhost it will run now unless you have another job hanging the queue.

Open the web panel and watch the schedules when you do:

MyJob.set(wait: 1.minute).perform_later(1)
MyJob.set(wait: 1.minute).perform_later(1)

It will schedule only one job.

@Fredar
Copy link

Fredar commented Aug 21, 2015

It seems that this unique initializer wont work with jobs that include set:
MyJob.set(wait: 30.seconds).perform_later
The job is enqueued, but it never runs.

Not sure how it could be connected.

@guivinicius
Copy link

We actually dropped Activejob and start using plain Sidekiq jobs. It makes sense if you think that you're using too many specific Sidekiq things.

@Fredar
Copy link

Fredar commented Aug 21, 2015

Turns out that my problem was caused by something in version 3.0.14.
#93

@rafaellima
Copy link
Author

Turns out we had a migraine to get this integration (Active Job + Unique Jobs) working. We're moving to the good old Sidekiq + Unique Jobs integration.

@mhenrixon could you please close this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants