github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

edward / taskqueue

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 1
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Really simple Rails task queuing / delayed message passing — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Arrgh... forgot to remove a debug 
edward (author)
Tue Aug 19 12:27:02 -0700 2008
commit  eb789a22265dc1766f0a1b2f93389ed83ea2c266
tree    034154c006f9c207e3228b7e5587aca238a06a64
parent  55f0afeb3e6a87223d072b7bea91b012066f50f7
taskqueue /
name age
history
message
file README Loading commit data...
file Rakefile
directory app/
directory config/
directory generators/
file install.rb
directory lib/
directory script/
directory spec/
file uninstall.rb
README
=TaskQueue

TaskQueue makes it simple to schedule (probably non-urgent) method calls by storing 

  * a reference to your target object, 
  * the method to call on it,
  * any arguments to pass to that method,
  * when you want it to happen

At the moment, it's just another copy of your Rails app server running as a daemon service. It'd be nice to move this to 
a lighter server or a DRb instance or something.

Example usage:

  u = User.find :first
  TaskQueue.schedule(u, :send_password_reset_mail)
  TaskQueue.schedule(u, :send_witty_but_sincere_letter, 2.days.from_now)
  TaskQueue.schedule(u, :set_status, "awesome")
  TaskQueue.schedule(u, :set_status, "ambivalent", Time.now.tomorrow)

== Possible bugs

  * running multiple TaskQueue daemons is a bad idea due to the possibility of race conditions (i.e. there's no locking 
  happening to prevent tasks from being executed more than once).

== Todo
  * Add logging
  * Add a flag not to fork/daemonize
  * Write a TaskQueue.schedule_code to allow delayed/asynchronous evaluation of code

== Installation

  ruby script/plugin install git://github.com/edward/taskqueue.git

=== Prepare database

Generate and apply the migration:

  ruby script/generate task_queue_migration
  rake db:migrate
  
Fire this puppy up:

  ruby script/task_queue_daemon start

Shut 'er down:

  ruby script/task_queue_daemon stop

Restart the task queue daemon:

  ruby script/task_queue_daemon restart

== Usage

  c = Customer.find :first
  TaskQueue.schedule c, :to_salesforce, Date.today+1

Copyright (c) 2007 Edward Ocampo-Gooding, Patrick Ritchie, released under the MIT license
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server