Skip to content

Commit 6cbe882

Browse files
committed
Use Sidekiq for background processing.
1 parent 8cf769d commit 6cbe882

11 files changed

+24
-82
lines changed

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ gem 'sass-rails', '~> 5.0.1'
1111
gem 'uglifier', '>= 1.3.0'
1212
gem 'jquery-rails'
1313
gem 'net-ssh', '~> 2.9.1'
14-
gem 'delayed_job_active_record', '~> 4.0.3'
1514
gem 'platform-api', '~> 0.2.0'
1615
gem 'haml', '~> 4.0.5'
1716
gem 'bootstrap-sass', '~> 3.3.3'
1817
gem 'pygments.rb', '~> 0.6.0'
1918
gem 'redis', '~> 3.2.1'
2019
gem 'redis-rails', '~> 4.0.0'
20+
gem 'sidekiq', '~> 3.3.3'
2121

2222
group :development do
2323
gem 'spring'

Gemfile.lock

+15-6
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,17 @@ GEM
6767
capybara-webkit (1.3.1)
6868
capybara (>= 2.0.2, < 2.5.0)
6969
json
70+
celluloid (0.16.0)
71+
timers (~> 4.0.0)
7072
childprocess (0.5.5)
7173
ffi (~> 1.0, >= 1.0.11)
7274
coderay (1.1.0)
7375
columnize (0.8.9)
76+
connection_pool (2.1.3)
7477
crack (0.4.2)
7578
safe_yaml (~> 1.0.0)
7679
debug_inspector (0.0.2)
7780
debugger-linecache (1.2.0)
78-
delayed_job (4.0.6)
79-
activesupport (>= 3.0, < 5.0)
80-
delayed_job_active_record (4.0.3)
81-
activerecord (>= 3.0, < 5.0)
82-
delayed_job (>= 3.0, < 4.1)
8381
erubis (2.7.0)
8482
excon (0.41.0)
8583
execjs (2.2.2)
@@ -95,6 +93,7 @@ GEM
9593
multi_json (>= 1.9.2)
9694
netrc
9795
hike (1.2.3)
96+
hitimes (1.2.2)
9897
i18n (0.7.0)
9998
jquery-rails (4.0.0)
10099
rails-dom-testing (~> 1.0)
@@ -174,6 +173,8 @@ GEM
174173
redis-activesupport (4.0.0)
175174
activesupport (~> 4)
176175
redis-store (~> 1.1.0)
176+
redis-namespace (1.5.1)
177+
redis (~> 3.0, >= 3.0.4)
177178
redis-rack (1.5.0)
178179
rack (~> 1.5)
179180
redis-store (~> 1.1.0)
@@ -199,6 +200,12 @@ GEM
199200
multi_json (~> 1.0)
200201
rubyzip (~> 1.0)
201202
websocket (~> 1.0)
203+
sidekiq (3.3.3)
204+
celluloid (>= 0.16.0)
205+
connection_pool (>= 2.1.1)
206+
json
207+
redis (>= 3.0.6)
208+
redis-namespace (>= 1.3.1)
202209
slop (3.6.0)
203210
spring (1.1.3)
204211
sprockets (2.12.3)
@@ -213,6 +220,8 @@ GEM
213220
thor (0.19.1)
214221
thread_safe (0.3.4)
215222
tilt (1.4.1)
223+
timers (4.0.1)
224+
hitimes
216225
tzinfo (1.2.2)
217226
thread_safe (~> 0.1)
218227
uglifier (2.5.3)
@@ -239,7 +248,6 @@ DEPENDENCIES
239248
byebug
240249
capybara (~> 2.4.4)
241250
capybara-webkit (~> 1.3.1)
242-
delayed_job_active_record (~> 4.0.3)
243251
haml (~> 4.0.5)
244252
jquery-rails
245253
launchy (~> 2.4.3)
@@ -260,6 +268,7 @@ DEPENDENCIES
260268
rollbar (~> 1.3.1)
261269
sass-rails (~> 5.0.1)
262270
selenium-webdriver (~> 2.44.0)
271+
sidekiq (~> 3.3.3)
263272
spring
264273
uglifier (>= 1.3.0)
265274
vcr (~> 2.9.3)

Procfile

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
web: bundle exec puma -C config/puma.rb
2-
worker: bundle exec rake jobs:work

app/jobs/application_job.rb

-30
This file was deleted.

app/jobs/remote_server_job.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class RemoteServerJob < ApplicationJob
1+
class RemoteServerJob < ActiveJob::Base
22
queue_as :default
33

44
# Use keyword arguments once Rails 4.2.1 has been released.

bin/delayed_job

-5
This file was deleted.

config/application.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ class Application < Rails::Application
1919
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
2020
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
2121
# config.i18n.default_locale = :de
22-
config.active_job.queue_adapter = :delayed_job
22+
config.active_job.queue_adapter = :sidekiq
2323
end
2424
end

config/delayed_job.rb

-2
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class DropDelayedJobs < ActiveRecord::Migration
2+
def change
3+
drop_table :delayed_jobs
4+
end
5+
end

db/schema.rb

+1-17
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
# It's strongly recommended that you check this file into your version control system.
1313

14-
ActiveRecord::Schema.define(version: 20150128005821) do
14+
ActiveRecord::Schema.define(version: 20150310054307) do
1515

1616
# These are extensions that must be enabled in order to support this database
1717
enable_extension "plpgsql"
@@ -54,22 +54,6 @@
5454
add_index "commits", ["repo_id"], name: "index_commits_on_repo_id", using: :btree
5555
add_index "commits", ["sha1", "repo_id"], name: "index_commits_on_sha1_and_repo_id", unique: true, using: :btree
5656

57-
create_table "delayed_jobs", force: :cascade do |t|
58-
t.integer "priority", default: 0, null: false
59-
t.integer "attempts", default: 0, null: false
60-
t.text "handler", null: false
61-
t.text "last_error"
62-
t.datetime "run_at"
63-
t.datetime "locked_at"
64-
t.datetime "failed_at"
65-
t.string "locked_by"
66-
t.string "queue"
67-
t.datetime "created_at"
68-
t.datetime "updated_at"
69-
end
70-
71-
add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
72-
7357
create_table "organizations", force: :cascade do |t|
7458
t.string "name", null: false
7559
t.string "url", null: false

test/jobs/application_job_test.rb

-18
This file was deleted.

0 commit comments

Comments
 (0)