mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 11:44:02 +00:00
Delayed job integration done
This commit is contained in:
parent
0ae7991943
commit
c282f6c14e
6 changed files with 64 additions and 13 deletions
1
Gemfile
1
Gemfile
|
|
@ -91,6 +91,7 @@ gem 'rdoc-generator-fivefish'
|
|||
# We use factory_girl for seeds
|
||||
gem 'factory_girl_rails'
|
||||
|
||||
gem 'delayed_job_active_record'
|
||||
# We use ahoy for visitor tracking
|
||||
gem 'ahoy_matey'
|
||||
gem 'activeuuid'
|
||||
|
|
|
|||
|
|
@ -104,6 +104,11 @@ GEM
|
|||
railties (>= 3.1.0)
|
||||
database_cleaner (1.3.0)
|
||||
debugger-linecache (1.2.0)
|
||||
delayed_job (4.0.2)
|
||||
activesupport (>= 3.0, < 4.2)
|
||||
delayed_job_active_record (4.0.1)
|
||||
activerecord (>= 3.0, < 4.2)
|
||||
delayed_job (>= 3.0, < 4.1)
|
||||
devise (3.2.4)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
|
|
@ -406,6 +411,7 @@ DEPENDENCIES
|
|||
coveralls
|
||||
d3_rails
|
||||
database_cleaner
|
||||
delayed_job_active_record
|
||||
devise
|
||||
factory_girl_rails
|
||||
font-awesome-rails
|
||||
|
|
|
|||
5
bin/delayed_job
Executable file
5
bin/delayed_job
Executable file
|
|
@ -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
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
require 'rubygems'
|
||||
|
||||
require 'yaml'
|
||||
YAML::ENGINE.yamler = 'syck'
|
||||
# Set up gems listed in the Gemfile.
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
|
||||
|
|
|
|||
22
db/migrate/20140719160903_create_delayed_jobs.rb
Normal file
22
db/migrate/20140719160903_create_delayed_jobs.rb
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
class CreateDelayedJobs < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :delayed_jobs, force: true do |table|
|
||||
table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue
|
||||
table.integer :attempts, default: 0, null: false # Provides for retries, but still fail eventually.
|
||||
table.text :handler, null: false # 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.string :queue # The name of the queue this job is in
|
||||
table.timestamps
|
||||
end
|
||||
|
||||
add_index :delayed_jobs, [:priority, :run_at], name: 'delayed_jobs_priority'
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :delayed_jobs
|
||||
end
|
||||
end
|
||||
40
db/schema.rb
40
db/schema.rb
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20140716115448) do
|
||||
ActiveRecord::Schema.define(version: 20140719160903) do
|
||||
|
||||
create_table "ahoy_events", force: true do |t|
|
||||
t.uuid "visit_id"
|
||||
|
|
@ -21,9 +21,9 @@ ActiveRecord::Schema.define(version: 20140716115448) do
|
|||
t.datetime "time"
|
||||
end
|
||||
|
||||
add_index "ahoy_events", ["time"], name: "index_ahoy_events_on_time", using: :btree
|
||||
add_index "ahoy_events", ["user_id"], name: "index_ahoy_events_on_user_id", using: :btree
|
||||
add_index "ahoy_events", ["visit_id"], name: "index_ahoy_events_on_visit_id", using: :btree
|
||||
add_index "ahoy_events", ["time"], name: "index_ahoy_events_on_time"
|
||||
add_index "ahoy_events", ["user_id"], name: "index_ahoy_events_on_user_id"
|
||||
add_index "ahoy_events", ["visit_id"], name: "index_ahoy_events_on_visit_id"
|
||||
|
||||
create_table "answers", force: true do |t|
|
||||
t.string "title"
|
||||
|
|
@ -70,9 +70,9 @@ ActiveRecord::Schema.define(version: 20140716115448) do
|
|||
t.integer "rgt"
|
||||
end
|
||||
|
||||
add_index "comments", ["commentable_id"], name: "index_comments_on_commentable_id", using: :btree
|
||||
add_index "comments", ["commentable_type"], name: "index_comments_on_commentable_type", using: :btree
|
||||
add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree
|
||||
add_index "comments", ["commentable_id"], name: "index_comments_on_commentable_id"
|
||||
add_index "comments", ["commentable_type"], name: "index_comments_on_commentable_type"
|
||||
add_index "comments", ["user_id"], name: "index_comments_on_user_id"
|
||||
|
||||
create_table "conferences", force: true do |t|
|
||||
t.string "guid", null: false
|
||||
|
|
@ -133,6 +133,22 @@ ActiveRecord::Schema.define(version: 20140716115448) do
|
|||
t.integer "question_id"
|
||||
end
|
||||
|
||||
create_table "delayed_jobs", force: true do |t|
|
||||
t.integer "priority", default: 0, null: false
|
||||
t.integer "attempts", default: 0, null: false
|
||||
t.text "handler", null: false
|
||||
t.text "last_error"
|
||||
t.datetime "run_at"
|
||||
t.datetime "locked_at"
|
||||
t.datetime "failed_at"
|
||||
t.string "locked_by"
|
||||
t.string "queue"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority"
|
||||
|
||||
create_table "dietary_choices", force: true do |t|
|
||||
t.integer "conference_id"
|
||||
t.string "title", null: false
|
||||
|
|
@ -446,9 +462,9 @@ ActiveRecord::Schema.define(version: 20140716115448) do
|
|||
t.text "volunteer_experience"
|
||||
end
|
||||
|
||||
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
|
||||
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
||||
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
|
||||
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
||||
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
||||
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||
|
||||
create_table "vchoices", force: true do |t|
|
||||
t.integer "vday_id"
|
||||
|
|
@ -491,7 +507,7 @@ ActiveRecord::Schema.define(version: 20140716115448) do
|
|||
t.datetime "created_at"
|
||||
end
|
||||
|
||||
add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree
|
||||
add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
|
||||
|
||||
create_table "visits", force: true do |t|
|
||||
t.uuid "visitor_id"
|
||||
|
|
@ -516,7 +532,7 @@ ActiveRecord::Schema.define(version: 20140716115448) do
|
|||
t.datetime "started_at"
|
||||
end
|
||||
|
||||
add_index "visits", ["user_id"], name: "index_visits_on_user_id", using: :btree
|
||||
add_index "visits", ["user_id"], name: "index_visits_on_user_id"
|
||||
|
||||
create_table "votes", force: true do |t|
|
||||
t.integer "event_id"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue