1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-24 17:04:43 +00:00

Fixed delayed job

This commit is contained in:
2015-02-09 11:02:00 -05:00
parent e09ec3356b
commit 3b93c337c7
5 changed files with 71 additions and 25 deletions

5
bin/delayed_job Executable file
View 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

View File

@@ -22,7 +22,8 @@ module Wrestling
#Add Bootstrap SAAS to asset pipeline
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
config.active_job.queue_adapter = :delayed_job
end
config.active_job.queue_adapter = :delayed_job
end

View 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 null: true
end
add_index :delayed_jobs, [:priority, :run_at], name: "delayed_jobs_priority"
end
def self.down
drop_table :delayed_jobs
end
end

View File

@@ -11,16 +11,32 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150206025407) do
ActiveRecord::Schema.define(version: 20150209154145) do
create_table "matches", force: true do |t|
create_table "delayed_jobs", force: :cascade 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 "matches", force: :cascade do |t|
t.integer "r_id"
t.integer "g_id"
t.text "g_stat"
t.text "r_stat"
t.integer "winner_id"
t.string "win_type"
t.string "score"
t.string "win_type", limit: 255
t.string "score", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.integer "tournament_id"
@@ -29,41 +45,41 @@ ActiveRecord::Schema.define(version: 20150206025407) do
t.integer "boutNumber"
end
create_table "mats", force: true do |t|
t.string "name"
create_table "mats", force: :cascade do |t|
t.string "name", limit: 255
t.integer "tournament_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "schools", force: true do |t|
t.string "name"
create_table "schools", force: :cascade do |t|
t.string "name", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.integer "tournament_id"
t.integer "score"
end
create_table "tournaments", force: true do |t|
t.string "name"
t.string "address"
t.string "director"
t.string "director_email"
create_table "tournaments", force: :cascade do |t|
t.string "name", limit: 255
t.string "address", limit: 255
t.string "director", limit: 255
t.string "director_email", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "users", force: true do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
create_table "users", force: :cascade do |t|
t.string "email", limit: 255, default: "", null: false
t.string "encrypted_password", limit: 255, default: "", null: false
t.string "reset_password_token", limit: 255
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.string "current_sign_in_ip", limit: 255
t.string "last_sign_in_ip", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
end
@@ -71,15 +87,15 @@ ActiveRecord::Schema.define(version: 20150206025407) do
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 "weights", force: true do |t|
create_table "weights", force: :cascade do |t|
t.integer "max"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "tournament_id"
end
create_table "wrestlers", force: true do |t|
t.string "name"
create_table "wrestlers", force: :cascade do |t|
t.string "name", limit: 255
t.integer "school_id"
t.integer "weight_id"
t.integer "seed"
@@ -88,7 +104,7 @@ ActiveRecord::Schema.define(version: 20150206025407) do
t.datetime "updated_at"
t.integer "season_win"
t.integer "season_loss"
t.string "criteria"
t.string "criteria", limit: 255
t.integer "poolNumber"
t.boolean "extra"
end

2
notes.txt Normal file
View File

@@ -0,0 +1,2 @@
run delayed jobs in dev
rake jobs:work