Commit f51a44de1357d55384b2453b93cc032ff58540eb
1 parent
d27dd0c1
Exists in
master
and in
1 other branch
adding delayed job
Showing
3 changed files
with
38 additions
and
0 deletions
Show diff stats
@@ -2,4 +2,5 @@ thoughtbot-clearance --version '>= 0.6.8' --source gems.github.com | @@ -2,4 +2,5 @@ thoughtbot-clearance --version '>= 0.6.8' --source gems.github.com | ||
2 | RedCloth --version '= 4.1.1' | 2 | RedCloth --version '= 4.1.1' |
3 | mislav-will_paginate --version '~> 2.3.11' --source gems.github.com | 3 | mislav-will_paginate --version '~> 2.3.11' --source gems.github.com |
4 | ambethia-smtp-tls --version '1.1.2' --source gems.github.com | 4 | ambethia-smtp-tls --version '1.1.2' --source gems.github.com |
5 | +tobi-delayed_job --version '1.7.0' --source gems.github.com | ||
5 | 6 |
README.markdown
@@ -14,6 +14,8 @@ This will create a Rails 2.3.2 app with: | @@ -14,6 +14,8 @@ This will create a Rails 2.3.2 app with: | ||
14 | * Cucumber, Shoulda, Factory Girl, & Mocha for testing | 14 | * Cucumber, Shoulda, Factory Girl, & Mocha for testing |
15 | * Hoptoad Notifier for exception notification | 15 | * Hoptoad Notifier for exception notification |
16 | * Paperclip for file uploads, set for Amazon S3 | 16 | * Paperclip for file uploads, set for Amazon S3 |
17 | +* Coulda for model, controller, & helper generators | ||
18 | +* Delayed Job for background processing | ||
17 | * Will Paginate for pagination | 19 | * Will Paginate for pagination |
18 | * RedCloth for Textile formatting | 20 | * RedCloth for Textile formatting |
19 | 21 |
@@ -0,0 +1,35 @@ | @@ -0,0 +1,35 @@ | ||
1 | +class CreateDelayedJobs < ActiveRecord::Migration | ||
2 | + def self.up | ||
3 | + create_table :delayed_jobs do |table| | ||
4 | + # Allows some jobs to jump to the front of the queue | ||
5 | + table.integer :priority, :default => 0 | ||
6 | + | ||
7 | + # Provides for retries, but still fail eventually. | ||
8 | + table.integer :attempts, :default => 0 | ||
9 | + | ||
10 | + # YAML-encoded string of the object that will do work | ||
11 | + table.text :handler | ||
12 | + | ||
13 | + # reason for last failure (See Note below) | ||
14 | + table.string :last_error | ||
15 | + | ||
16 | + # When to run. Could be Time.now for immediately, or sometime in the future. | ||
17 | + table.datetime :run_at | ||
18 | + | ||
19 | + # Set when a client is working on this object | ||
20 | + table.datetime :locked_at | ||
21 | + | ||
22 | + # Set when all retries have failed (actually, by default, the record is deleted instead) | ||
23 | + table.datetime :failed_at | ||
24 | + | ||
25 | + # Who is working on this object (if locked) | ||
26 | + table.string :locked_by | ||
27 | + | ||
28 | + table.timestamps | ||
29 | + end | ||
30 | + end | ||
31 | + | ||
32 | + def self.down | ||
33 | + drop_table :delayed_jobs | ||
34 | + end | ||
35 | +end |