ryandotsmith/queue_classic — pull request #217 by severin (2014-05-06 09:44:17+00:00)
Title: Support for scheduling jobs in the future

I think having the ability to schedule a job for execution after a given point in time is a crucial feature for a background processing system.
At the moment, this is possible with *queue_classic* only by using [queue_classic-later](https://github.com/dpiddy/queue_classic-later), which is quite clunky to use (you need a second database table and a tick process).

So I quickly implemented a very minimal solution that uses the already existing *created_at* column of the jobs table to specify the time by which a job may be executed.

##### Example:

```ruby
# schedule a job in 10 seconds
QC.enqueue_at Time.now + 10, 'Kernel.puts'
# job is not being locked at this point in time
QC.lock # => nil
# when you wait (at least) 10 seconds...
sleep 10
# job can be locked now
QC.lock # => {method: 'Kernel.puts', ...}

# scheduling a job without a time constraint
# works just as it used to
QC.enqueue 'Kernel.print'
QC.lock # => {method: 'Kernel.print', ...}
```

What do you think? Is this feature generally a useful addition? If yes: is the implementation/API ok or would there be a better solution?