Skip to content
This repository was archived by the owner on Jan 29, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
17d248c
Depend on json_pure for JRuby compat
defunkt Jul 26, 2010
d834b90
Upgrade redis-namespace dependency
defunkt Jul 26, 2010
f144aad
v1.9.9
defunkt Jul 26, 2010
3139fac
Bugfix: before_fork should get passed the job
defunkt Aug 7, 2010
d83b7b3
v1.9.10
defunkt Aug 7, 2010
d75e0d6
Optional leftright support
defunkt Aug 9, 2010
8f5ff34
Support redis:// format. Closes #133
defunkt Aug 9, 2010
3840c79
make shutdown? method, which plugins can override
nevans Jul 29, 2010
c70d454
Fix grammar in README
chrislerum Aug 18, 2010
28e3f03
Switch from the json_pure gem to the json gem, which is now cross-pla…
Aug 17, 2010
1840616
Allow the Redis namespace to be set via "host:port/namespace"
quirkey Aug 10, 2010
f15aedb
Tests for setting the resque-namespace through the url-string
quirkey Aug 23, 2010
ff5fc9b
Merge branch 'master' of github.com:defunkt/resque
defunkt Aug 24, 2010
3d9814d
fix working page in web interface so counts are displayed correctly
Aug 19, 2010
193289b
after_enqueue hook
darkhelmet Jul 30, 2010
61d9cb5
Add docs for after_enqueue hook
darkhelmet Aug 9, 2010
4d7dcc5
Merge branch 'master' of github.com:defunkt/resque
defunkt Aug 24, 2010
3c7bd9e
v1.10.0
defunkt Aug 24, 2010
76f0597
Web UI: Group /workers page by hostnames
defunkt Aug 24, 2010
aba6f6f
v1.11.0
defunkt Aug 24, 2010
1852cea
Web UI: Sort workers, don't always show subtabs
defunkt Aug 24, 2010
37385f1
new archive url
defunkt Sep 3, 2010
db3bdf6
add uniqueness test for later
mediocretes Sep 27, 2010
9fbe0d9
fork resque to use mongo instead of redis
mediocretes Sep 28, 2010
9cdd035
some worker cleanup
mediocretes Sep 28, 2010
031f4d7
implement bypass_queues
mediocretes Sep 28, 2010
d6090f7
added resque-igo gemspec
mediocretes Sep 28, 2010
d4270cc
proper name for gem
mediocretes Sep 28, 2010
c2bc4ff
implemented unique tasks
mediocretes Sep 29, 2010
4497018
simplified the unique-id lookup in job creation
mediocretes Sep 29, 2010
587ef67
adds some instructions to readme
mediocretes Sep 29, 2010
043dfa9
moves a test, updates README
mediocretes Sep 29, 2010
177ab3a
implements delayed jobs
mediocretes Sep 30, 2010
e039019
changed rg to use patch instead of rg command line, changed failed to…
mediocretes Oct 5, 2010
b23d834
added 3 size queries for delayed jobs, made delayable queues initiali…
mediocretes Oct 5, 2010
468ba04
updates server app for new delayed structure, better support for mong…
mediocretes Oct 5, 2010
2637cb5
made delayed queue test a bit more robust
mediocretes Oct 8, 2010
a48aeaa
Remove sorting in pop operation for speed.
mediocretes Oct 27, 2010
88067dc
Removed ability for delayed and non delayed jobs to coexist in queues
mediocretes Oct 27, 2010
bb97dbc
failure backend for mongo that just might work
mediocretes Oct 28, 2010
e05bc1c
bump version
mediocretes Oct 28, 2010
2642eac
changed redis to mogno
mediocretes Oct 28, 2010
d93fa62
more failure fixes. sorry for the spam, this is hard to test
mediocretes Oct 28, 2010
b6bc76d
fix for failure/all issue
mediocretes Oct 28, 2010
a79da22
version bump
mediocretes Oct 28, 2010
34e5b22
added timestamp to all jobs
mediocretes Nov 3, 2010
235ab04
how did my .gem get in there?
mediocretes Nov 3, 2010
797a502
Revert "how did my .gem get in there?"
mediocretes Nov 3, 2010
2c29f96
removed gem for real
mediocretes Nov 3, 2010
d987862
fix enqueued at/processes in issues
mediocretes Nov 3, 2010
b43ff77
bad variable name
mediocretes Nov 3, 2010
a591f1f
this time, I actually tested it, enqueue-at works and looks good now
mediocretes Nov 3, 2010
e09c2f6
style cleanup
mediocretes Nov 3, 2010
e7e91d0
add hydra feature
mediocretes Dec 1, 2010
ef8fea6
gratuitous version bump
mediocretes Dec 1, 2010
1564e07
hydra now hashes ids for unique jobs
mediocretes Dec 3, 2010
78ced6d
resque queues now shows queue size
mediocretes Dec 9, 2010
df77667
fix issue on failure page with only one failure
mediocretes Dec 10, 2010
f217309
new pop sorting, should be more accurate and just as fast
mediocretes Dec 14, 2010
bd6b5ca
roll back _id sort change, it's just not fast enough
mediocretes Dec 14, 2010
f11a644
Revert "roll back _id sort change, it's just not fast enough"
mediocretes Dec 15, 2010
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
## 1.11.0 (2010-08-23)

* Web UI: Group /workers page by hostnames

## 1.10.0 (2010-08-23)

* Support redis:// string format in `Resque.redis=`
* Using new cross-platform JSON gem.
* Added `after_enqueue` plugin hook.
* Added `shutdown?` method which can be overridden.
* Added support for the "leftright" gem when running tests.
* Grammarfix: In the README

## 1.9.10 (2010-08-06)

* Bugfix: before_fork should get passed the job

## 1.9.9 (2010-07-26)

* Depend on redis-namespace 0.8.0
* Depend on json_pure instead of json (for JRuby compat)
* Bugfix: rails_env display in stats view

## 1.9.8 (2010-07-20)

* Bugfix: Worker.all should never return nil
Expand Down
67 changes: 64 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Background jobs can be any Ruby class or module that responds to
jobs or you can create new classes specifically to do work. Or, you
can do both.

Resque is heavily inspired by DelayedJob (which rocks) and is
comprised of three parts:
Resque is heavily inspired by DelayedJob (which rocks) and comprises
three parts:

1. A Ruby library for creating, querying, and processing jobs
2. A Rake task for starting a worker which processes jobs
Expand All @@ -30,6 +30,67 @@ not doing, what queues you're using, what's in those queues, provides
general usage stats, and helps you track failures.


What did you guys do to Resque?
===============================

This version of Resque uses mongo as the back end. It also has some neat
new features that you may enjoy

Features
--------

It stores each queue in its own collection.

For testing purposes. Resque.bypass_queues will call your job's
perform method AT ONCE, and not touch the queue at all. This can be
useful when writing unit tests against things that would normally
happen partially in your request and partially in a worker.

If your job class has a variable called @unique_jobs = true, you
can queue unique jobs - jobs that must only be processed once. In
order to take advantage of this feature, the arguments to your enqueue
call must include a hash containing a key called _id in the first
position.

If your job class indicates that @delayed_jobs = true, you can queue
delayed jobs. These jobs will not be popped off the queue until the
Time indicated in arg[0][:delay_until] has come. Note that you must
call Resque.enable_delay(:queue) before enququing any delayed jobs, to
ensure that the performance impact on other queues is minimal.

Stern Warnings
--------------

Sometimes, Resque-Mongo will drop a queue collection, or create some
indexes, or otherwise manipulate its database. For this reason, it is
STRONGLY recommended that you give it its own database in mongo.

All jobs should be queued via Resque.enqueue. All arguments passed to
this method must be BSON-encodable. Resque-Mongo does not serialize
your objects for you. Arrays, Hashes, Strings, Numbers, and Times
are all ok, so don't worry.

Many of the new queue-level features require the first argument of
your perform method to be an options hash. In fact, if you just start
making all your perform()s take one param, that is an options hash,
you'll probably save yourself some pain.

Resque-Mongo will not create any indexes on your queues, only on its
meta-data. You will need to create any indexes you want. Normally,
This is not a problem, because you aren't querying by keys, but you may
want to create indexes on the class key in some circumstances. If you
use the unique or delay features, you may want some additional indexes,
depending on the nature of your workload. Paranoid? Test enqueuing and
processing all your jobs, and run with --notablescans. Learn the profiler,
and use it often.

Specifically, a queue with many long-delayed jobs will result in slower queue pops
for all jobs using that queue. Index delay_until in the case of
thousands of delayed jobs.

Back to the original README
===========================

The Blog Post
-------------

Expand Down Expand Up @@ -764,7 +825,7 @@ To join the list simply send an email to <resque@librelist.com>. This
will subscribe you and send you information about your subscription,
including unsubscribe information.

The archive can be found at <http://librelist.com/browser/>.
The archive can be found at <http://librelist.com/browser/resque/>.


Meta
Expand Down
7 changes: 3 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#
# Setup
#

load 'tasks/redis.rake'
require 'rake/testtask'

$LOAD_PATH.unshift 'lib'
Expand All @@ -23,7 +21,8 @@ desc "Run the test suite"
task :test do
rg = command?(:rg)
Dir['test/**/*_test.rb'].each do |f|
rg ? sh("rg #{f}") : ruby(f)
#rg ? sh("rg #{f}") : ruby(f)
ruby(f)
end
end

Expand All @@ -40,7 +39,7 @@ end
# Install
#

task :install => [ 'redis:install', 'dtach:install' ]
task :install => [ 'dtach:install' ]


#
Expand Down
10 changes: 10 additions & 0 deletions bin/resque
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby

$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
require 'rubygems'
require 'resque'

def kill(worker)
Expand Down Expand Up @@ -34,6 +35,12 @@ def list
end
end

def queues
Resque.queues.each do |queue|
puts"Queue #{queue}: #{Resque.size(queue)}"
end
end

if (i = ARGV.index('-r')) && ARGV[i+1]
Resque.redis = ARGV[i+1]
ARGV.delete_at(i)
Expand All @@ -47,11 +54,14 @@ when 'remove'
remove ARGV[1]
when 'list'
list
when 'queues'
queues
else
puts "Usage: resque [-r redis_host:redis_port] COMMAND [option]"
puts
puts "Commands:"
puts " remove WORKER Removes a worker"
puts " kill WORKER Kills a worker"
puts " list Lists known workers"
puts " queues checks queue depth"
end
6 changes: 3 additions & 3 deletions bin/resque-web
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Vegas::Runner.new(Resque::Server, 'resque-web', {
load path.to_s.strip if path
}
}) do |runner, opts, app|
opts.on('-N NAMESPACE', "--namespace NAMESPACE", "set the Redis namespace") {|namespace|
runner.logger.info "Using Redis namespace '#{namespace}'"
Resque.redis.namespace = namespace
opts.on('-N NAMESPACE', "--namespace NAMESPACE", "set the Mongo database") {|namespace|
runner.logger.info "Using Mongo database '#{namespace}'"
Resque.mongo_db= namespace
}
end
11 changes: 11 additions & 0 deletions docs/HOOKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ An unnamed hook (`before_perform`) will be executed first.

The available hooks are:

* `after_enqueue`: Called with the job args after a job is placed on the queue.
Any exception raised propagates up to the code which queued the job.

* `before_perform`: Called with the job args before perform. If it raises
`Resque::Job::DontPerform`, the job is aborted. If other exceptions
are raised, they will be propagated up the the `Resque::Failure`
Expand Down Expand Up @@ -99,6 +102,13 @@ look something like this.

Modules are even better because jobs can use many of them.

module ScaledJob
def after_enqueue_scale_workers(*args)
Logger.info "Scaling worker count up"
Scaler.up! if Redis.info[:pending].to_i > 25
end
end

module LoggedJob
def before_perform_log_job(*args)
Logger.info "About to perform #{self} with #{args.inspect}"
Expand All @@ -115,6 +125,7 @@ Modules are even better because jobs can use many of them.
class MyJob
extend LoggedJob
extend RetriedJob
extend ScaledJob
def self.perform(*args)
...
end
Expand Down
Loading