lantins / resque-lock-timeout

A Resque plugin; adds locking, with optional timeout/deadlock handling to resque jobs.
MIT License
53 stars 20 forks source link

Make “loner” implementation comply with its specification #24

Open amiryal opened 10 years ago

amiryal commented 10 years ago

The default loner() method is accepting *args, but they are not passed along where this method is called.

Note, this pull request includes a test case, but it only covers one code path, whereas I fixed 3 different places.

lantins commented 9 years ago

Long delay!

I'm inclined to merge this and trust your judgment, the problem I have is I'm not familiar with the loner plugin :/

amiryal commented 9 years ago

@lantins, it’s OK, it took me a little while to regain mental image, too.

Notice how the method LonelyWithArgsJob.loner() is implemented, echoing back the argument given to it, defaulting to false. So, in the test, if the job is submitted with no arguments, it should not be treated as a loner, whereas submitting with an argument of true makes it a loner and rejects the second submission.

BTW, if you run the new test on the code before this patch, the first assertion passes. It’s the other assertion that fails, because it depends on propagation of the *args, which the patch fixes.

Hope this helps.