Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Resque plugin allowing jobs to access to their calling worker at runtime (and thus to share sockets).
Ruby
Tag: v0.1.2

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
rails
.document
.gitignore
LICENSE
README.rdoc
Rakefile
VERSION
init.rb

README.rdoc

Resque-AccessWorkerFromJob

Small plugin appending the calling worker to the argument list received by the perform method of Resque jobs. Developed against Resque 1.8.0.

Purpose: this allows jobs to access shared sockets in the parent worker.

Warning

Be careful to note that each job forks before running, so ivars will be a COPY and, if changed, their changes won't persist into the next job's perform method. However, since sockets ARE persisted, this allows multiple jobs to share a single persistent socket kept alive in the worker.

Only running in certain workers

As additional functionality, this plugin can also abort a job gracefully if it's picked up by the wrong worker class, which is useful if you've subclassed Resque::Worker to add your own functionality and need to ensure your jobs aren't accidentally run against the original superclass.

Usage

To use, add

extend Resque::Plugins::AccessWorkerFromJob

to the class with the perform method.

To implement the additional requiring-certain-worker-class feature, add

self.required_worker_class = 'ClassName'

as well.

Copyright

Copyright © 2010 Kali Donovan. See LICENSE for details.

Something went wrong with that request. Please try again.