Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add delayed job and delayed_mailhopper

  • Loading branch information...
commit b122ca4b60f10dbae8238d95ad3171f39214295d 1 parent 6c39d7a
@jordanbyron jordanbyron authored
View
1  Gemfile
@@ -13,6 +13,7 @@ gem 'compass', '~> 0.11.5'
gem "jquery-rails"
gem 'mailhopper'
+gem 'delayed_mailhopper'
group :test do
gem "minitest", "~> 2.3.1"
View
8 Gemfile.lock
@@ -42,6 +42,13 @@ GEM
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
+ daemons (1.1.4)
+ delayed_job (2.1.4)
+ activesupport (~> 3.0)
+ daemons
+ delayed_mailhopper (0.0.2)
+ delayed_job
+ mailhopper (~> 0.0.1)
erubis (2.7.0)
factory_girl (2.1.0)
factory_girl_rails (1.2.0)
@@ -170,6 +177,7 @@ PLATFORMS
DEPENDENCIES
colorific (~> 1.0.0)
compass (~> 0.11.5)
+ delayed_mailhopper
factory_girl_rails
haml
hominid
View
21 db/migrate/20110916132222_create_delayed_jobs.rb
@@ -0,0 +1,21 @@
+class CreateDelayedJobs < ActiveRecord::Migration
+ def self.up
+ create_table :delayed_jobs, :force => true do |table|
+ table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue
+ table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually.
+ table.text :handler # YAML-encoded string of the object that will do work
+ table.text :last_error # reason for last failure (See Note below)
+ table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
+ table.datetime :locked_at # Set when a client is working on this object
+ table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
+ table.string :locked_by # Who is working on this object (if locked)
+ table.timestamps
+ end
+
+ add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
+ end
+
+ def self.down
+ drop_table :delayed_jobs
+ end
+end
View
17 db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110916131749) do
+ActiveRecord::Schema.define(:version => 20110916132222) do
create_table "announcements", :force => true do |t|
t.text "title"
@@ -57,6 +57,21 @@
t.datetime "updated_at"
end
+ create_table "delayed_jobs", :force => true do |t|
+ t.integer "priority", :default => 0
+ t.integer "attempts", :default => 0
+ t.text "handler"
+ t.text "last_error"
+ t.datetime "run_at"
+ t.datetime "locked_at"
+ t.datetime "failed_at"
+ t.string "locked_by"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
+
create_table "emails", :force => true do |t|
t.string "from_address", :null => false
t.string "to_address"
View
5 script/delayed_job
@@ -0,0 +1,5 @@
+#!/usr/bin/env ruby
+
+require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
+require 'delayed/command'
+Delayed::Command.new(ARGV).daemonize
Please sign in to comment.
Something went wrong with that request. Please try again.