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

while_executing working wrong #193

Closed
hiennguyenvan-agilityio opened this issue Aug 29, 2016 · 12 comments
Closed

while_executing working wrong #193

hiennguyenvan-agilityio opened this issue Aug 29, 2016 · 12 comments

Comments

@hiennguyenvan-agilityio
Copy link

hiennguyenvan-agilityio commented Aug 29, 2016

As description, it is to make sure that a job can be scheduled any number of times but only executed a single time per argument provided to the job we call this runtime uniqueness. But it not work for me

class Job
  include Sidekiq::Worker
  sidekiq_options queue: :test, retry: true, unique: :while_executing

  def perform(arg)
    sleep 5.minutes
  end
end

Job.perform_async(1)
Job.perform_async(1)
Job.perform_async(2)

Have two Job with arg is 1 execute at the time

screen shot 2016-08-29 at 17 31 24

System information

Sidekiq Config

:queues:
  - test
  - default
:limits:
  test: 3
@natematykiewicz
Copy link

Have you tried it without sidekiq-limit_fetch? Its says that it's incompatible with "any other plugin that rewrites fetch strategy of sidekiq.".

This limit fetch gem is going to try to control when jobs are performed from the queue, but that's exactly what this gem is needs to do for the while_executing option.

@hiennguyenvan-agilityio
Copy link
Author

hiennguyenvan-agilityio commented Sep 5, 2016

@natematykiewicz Thank for feedback.

I just check it without sidekiq-limit_fetch. It's same result, still have two Job with arg is 1 execute at the time.

@hiennguyenvan-agilityio
Copy link
Author

Below is list gem relate with sidekiq I used

gem 'sidekiq', '~> 4.1', '>= 4.1.2'
gem 'sidekiq-cron', '~> 0.4.0'
gem 'sidekiq-failures'
# gem 'sidekiq-limit_fetch'
gem 'sidekiq-statistic'
gem 'sidekiq-unique-jobs'

@natematykiewicz
Copy link

If I were you, I'd remove all gems except sidekiq and sidekiq-unique-jobs and then see what you get. If it works, start adding gems in until you find one that doesn't seem to be compatible with sidekiq-unique-jobs.

@hiennguyenvan-agilityio
Copy link
Author

gem 'sidekiq', '~> 4.1', '>= 4.1.2'
# gem 'sidekiq-cron', '~> 0.4.0'
# gem 'sidekiq-failures'
# gem 'sidekiq-limit_fetch'
# gem 'sidekiq-statistic'
gem 'sidekiq-unique-jobs'

It's same result, still have two Job with arg is 1 execute at the time.

@aserafin
Copy link

aserafin commented Sep 8, 2016

I had the same experience - the only option that seems to work for me is until_executed

@cheneveld
Copy link

I was having some issues with this. I initially had one worker process with 2 queues:

worker: env DB_POOL=$WORKER_CONCURRENCY bundle exec sidekiq -q default -q keep_em_cached -c $WORKER_CONCURRENCY

And moved my unique jobs on its own process

worker: env DB_POOL=$WORKER_CONCURRENCY bundle exec sidekiq -q default -q keep_em_cached -c $WORKER_CONCURRENCY
another_worker: env DB_POOL=4 bundle exec sidekiq -q another_queue -c 4

This seemed to solve my unique issues. I didn't investigate any more than this so, I can't say what was actually happening.

@mhenrixon
Copy link
Owner

Thanks for the report @cheneveld

@hiennguyenvan-agilityio
Copy link
Author

Sorry, I'm pretty busy recent time.

@cheneveld, @mhenrixon Tried split 2 process but no luck. It's same result.

@untoldone
Copy link

untoldone commented Feb 22, 2017

@mhenrixon This seems like a pretty core use case to be broken? Super simple repro:

class TestWorker
  include Sidekiq::Worker

  sidekiq_options unique: :while_executing

  def perform(one, two)
    sleep 10
  end
end

And then start with

TestWorker.perform_async 1, 2
TestWorker.perform_async 1, 2
TestWorker.perform_async 1, 2
TestWorker.perform_async 1, 2
TestWorker.perform_async 1, 2

Redis: 3.2.6 (single node, nothing special)
Sidekiq: 4.2.9
Sidekiq-unique-jobs: 4.0.18

Am I missing something here? If this is truly broken, should it be reflected in docs?

@jasonbuehler
Copy link

I am also seeing this behavior. Is while_executing option broken? It doesn't appear to lock other jobs out, everything with the same args enqueues all at once.

@mhenrixon
Copy link
Owner

It has been somewhat fixed in v5.0.5. Check the readme for how it currently works: https://github.com/mhenrixon/sidekiq-unique-jobs#while-executing

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

7 participants