Giter Club home page Giter Club logo

Comments (7)

mhenrixon avatar mhenrixon commented on August 17, 2024

@adsteel the uniqueness is based on arguments you configure in the unique_args method or we will create a unique hash from all the arguments the .perform_async method receives. With no args provided to a job the job will be unique until just before or just after it has been performed depending on configuration.

My best suggestion for figuring it out is to check the test suite. It should cover the basics but you raise a valid point. Maybe we need more of an examples directory with all the various ways to configure uniqueness.

from sidekiq-unique-jobs.

adsteel avatar adsteel commented on August 17, 2024

@mhenrixon Thanks. I think I misspoke. I said 'what does that mean?', but I meant 'how is that implemented'? More specifically, what happens if I put two different jobs in the queue that each match the uniqueness constraint? Does the first job block until the second performs? Is the second never performed?

from sidekiq-unique-jobs.

Benjamin-Dobell avatar Benjamin-Dobell commented on August 17, 2024

@mhenrixon @adsteel's question is a good one - I'm equally confused about this very same thing.

Also what does this mean (https://github.com/mperham/sidekiq/wiki/Related-Projects) in relation to this project?

@mperham's note: job uniqueness or locking is impossible to implement safely and efficiently in a distributed system. I recommend using optimistic or pessimistic locking with database transactions instead of using these projects.

from sidekiq-unique-jobs.

Benjamin-Dobell avatar Benjamin-Dobell commented on August 17, 2024

Alright, by looking at the specs it seems that the job is just discarded - not the correct behaviour for my use-case - ah well.

from sidekiq-unique-jobs.

cjbottaro avatar cjbottaro commented on August 17, 2024

Agreed. Documentation is unclear. Is this gem for unique queues or unique workers?

The former means (job type, *args) can only exist once per queue, e.g. the queue acts as an ordered set.
Ex: https://github.com/resque/resque-loner

The latter means (job type, *args) can only be worked on by one worker at a time.
Ex: https://github.com/wallace/resque-lonely_job

Which does this gem do?

from sidekiq-unique-jobs.

mhenrixon avatar mhenrixon commented on August 17, 2024

@cjbottaro both!

You can make a job unique in a specific queue or across all queues. You can also decide when the uniqueness is enforced within that restriction like if the job should only be considered unique while it is running or if the uniqueness should be until before or after it is processed.

from sidekiq-unique-jobs.

mhenrixon avatar mhenrixon commented on August 17, 2024

Documentation has been improved and so has test suites, naming etc.

from sidekiq-unique-jobs.

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.