opened
adsteel
username_0
I'm trying to understand what this gem does, but the documentation isn't very clear on a basic level. So we're making jobs `unique` based on worker and arguments. What does that mean? Is only one unique job allowed in the queue at a time? (Meaning that if I put two different jobs in the queue that each match the `unique_args` constraint, is the second job never executed?) Or are two unique jobs allowed in the queue, but processed consecutively?
Documentation Not Clear
issue
created
mhenrixon
username_1
@username_0 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.
comment
created
adsteel
username_0
@username_1 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?
comment
created
Benjamin-Dobell
username_2
@username_1 @username_0'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.
```
comment
created
Benjamin-Dobell
username_2
Alright, by looking at the specs it seems that the job is just discarded - not the correct behaviour for my use-case - ah well.
comment
created
cjbottaro
username_3
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?
comment
created
mhenrixon
username_1
@username_3 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.
comment
closed
mhenrixon
username_1
issue
created
mhenrixon
username_1
Documentation has been improved and so has test suites, naming etc.
comment