Skip to content

Commit

Permalink
Mentioned enqueue_to/dequeue_from in README
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannis Hermanns committed Aug 3, 2010
1 parent 457f6a2 commit 86313b3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Resque-Loner
======

Resque-Loner is a plugin for defunkt/resque which adds unique jobs to resque. In each queue, there can be at most one UniqueJob with the same parameters.
Resque-Loner is a plugin for defunkt/resque which adds unique jobs to resque: Only one job with the same payload per queue.


Installation
Expand Down Expand Up @@ -60,6 +60,14 @@ Since resque-loner keeps track of which jobs are queued in a way that allows for
=> true
>> Resque.enqueued? CacheSweeper, 2
=> false
>> Resque.enqueued_in? :another_queue, CacheSweeper, 1
=> false

If you want the same type of job in different queues, resque-loner lets you enqueue/dequeue to a queue of your choice:

>> Resque.enqueue_to :another_queue, CacheSweeper, 1
=> "OK"
>> Resqueue.dequeue_from :another_queue, CacheSweeper, 1

How it works
--------
Expand Down Expand Up @@ -93,4 +101,4 @@ So when your job overwrites the #redis_key method, make sure these requirements

### Resque integration

Unfortunately not everything could be done as a plugin, so I overwrote three methods of Resque::Job: create, reserve and destroy (there were no hooks for these events). All the logic is in `module Resque::Plugins::Loner` though, so it should be fairly easy to make this a *pure* plugin once the hooks are there.
Unfortunately not everything could be done as a plugin, so I overwrote three methods of Resque::Job: create, reserve and destroy (I found no hooks for these events). All the logic is in `module Resque::Plugins::Loner` though, so it should be fairly easy to make this a *pure* plugin once the hooks are known.

0 comments on commit 86313b3

Please sign in to comment.