mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 13:09:18 +08:00
FEATURE: upgrade to Sidekiq 4
This commit is contained in:
parent
8af5c7385e
commit
426299d261
2
Gemfile
2
Gemfile
|
@ -37,9 +37,9 @@ end
|
||||||
gem 'mail'
|
gem 'mail'
|
||||||
gem 'mime-types', require: 'mime/types/columnar'
|
gem 'mime-types', require: 'mime/types/columnar'
|
||||||
|
|
||||||
#gem 'redis-rails'
|
|
||||||
gem 'hiredis'
|
gem 'hiredis'
|
||||||
gem 'redis', require: ["redis", "redis/connection/hiredis"]
|
gem 'redis', require: ["redis", "redis/connection/hiredis"]
|
||||||
|
gem 'redis-namespace'
|
||||||
|
|
||||||
gem 'active_model_serializers', '~> 0.8.3'
|
gem 'active_model_serializers', '~> 0.8.3'
|
||||||
|
|
||||||
|
|
58
Gemfile.lock
58
Gemfile.lock
|
@ -63,49 +63,9 @@ GEM
|
||||||
debug_inspector (>= 0.0.1)
|
debug_inspector (>= 0.0.1)
|
||||||
builder (3.2.2)
|
builder (3.2.2)
|
||||||
byebug (6.0.2)
|
byebug (6.0.2)
|
||||||
celluloid (0.17.1.2)
|
|
||||||
bundler
|
|
||||||
celluloid-essentials
|
|
||||||
celluloid-extras
|
|
||||||
celluloid-fsm
|
|
||||||
celluloid-pool
|
|
||||||
celluloid-supervision
|
|
||||||
dotenv
|
|
||||||
nenv
|
|
||||||
rspec-logsplit (>= 0.1.2)
|
|
||||||
timers (>= 4.1.1)
|
|
||||||
celluloid-essentials (0.20.2.1)
|
|
||||||
bundler
|
|
||||||
dotenv
|
|
||||||
nenv
|
|
||||||
rspec-logsplit (>= 0.1.2)
|
|
||||||
timers (>= 4.1.1)
|
|
||||||
celluloid-extras (0.20.1)
|
|
||||||
bundler
|
|
||||||
dotenv
|
|
||||||
nenv
|
|
||||||
rspec-logsplit (>= 0.1.2)
|
|
||||||
timers (>= 4.1.1)
|
|
||||||
celluloid-fsm (0.20.1)
|
|
||||||
bundler
|
|
||||||
dotenv
|
|
||||||
nenv
|
|
||||||
rspec-logsplit (>= 0.1.2)
|
|
||||||
timers (>= 4.1.1)
|
|
||||||
celluloid-pool (0.20.1)
|
|
||||||
bundler
|
|
||||||
dotenv
|
|
||||||
nenv
|
|
||||||
rspec-logsplit (>= 0.1.2)
|
|
||||||
timers (>= 4.1.1)
|
|
||||||
celluloid-supervision (0.20.1.1)
|
|
||||||
bundler
|
|
||||||
dotenv
|
|
||||||
nenv
|
|
||||||
rspec-logsplit (>= 0.1.2)
|
|
||||||
timers (>= 4.1.1)
|
|
||||||
certified (1.0.0)
|
certified (1.0.0)
|
||||||
coderay (1.1.0)
|
coderay (1.1.0)
|
||||||
|
concurrent-ruby (1.0.0)
|
||||||
connection_pool (2.2.0)
|
connection_pool (2.2.0)
|
||||||
crass (1.0.2)
|
crass (1.0.2)
|
||||||
daemons (1.2.3)
|
daemons (1.2.3)
|
||||||
|
@ -117,7 +77,6 @@ GEM
|
||||||
docile (1.1.5)
|
docile (1.1.5)
|
||||||
domain_name (0.5.25)
|
domain_name (0.5.25)
|
||||||
unf (>= 0.0.5, < 1.0.0)
|
unf (>= 0.0.5, < 1.0.0)
|
||||||
dotenv (2.0.2)
|
|
||||||
ember-data-source (1.0.0.beta.16.1)
|
ember-data-source (1.0.0.beta.16.1)
|
||||||
ember-source (~> 1.8)
|
ember-source (~> 1.8)
|
||||||
ember-handlebars-template (0.1.5)
|
ember-handlebars-template (0.1.5)
|
||||||
|
@ -165,7 +124,6 @@ GEM
|
||||||
highline (1.7.7)
|
highline (1.7.7)
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
hiredis (0.6.0)
|
hiredis (0.6.0)
|
||||||
hitimes (1.2.3)
|
|
||||||
htmlentities (4.3.4)
|
htmlentities (4.3.4)
|
||||||
http-cookie (1.0.2)
|
http-cookie (1.0.2)
|
||||||
domain_name (~> 0.5)
|
domain_name (~> 0.5)
|
||||||
|
@ -215,7 +173,6 @@ GEM
|
||||||
multi_xml (0.5.5)
|
multi_xml (0.5.5)
|
||||||
multipart-post (2.0.0)
|
multipart-post (2.0.0)
|
||||||
mustache (1.0.2)
|
mustache (1.0.2)
|
||||||
nenv (0.2.0)
|
|
||||||
netrc (0.11.0)
|
netrc (0.11.0)
|
||||||
nokogiri (1.6.7.1)
|
nokogiri (1.6.7.1)
|
||||||
mini_portile2 (~> 2.0.0.rc2)
|
mini_portile2 (~> 2.0.0.rc2)
|
||||||
|
@ -345,7 +302,6 @@ GEM
|
||||||
rspec-html-matchers (0.7.0)
|
rspec-html-matchers (0.7.0)
|
||||||
nokogiri (~> 1)
|
nokogiri (~> 1)
|
||||||
rspec (~> 3)
|
rspec (~> 3)
|
||||||
rspec-logsplit (0.1.3)
|
|
||||||
rspec-mocks (3.2.1)
|
rspec-mocks (3.2.1)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.2.0)
|
rspec-support (~> 3.2.0)
|
||||||
|
@ -382,14 +338,13 @@ GEM
|
||||||
shoulda-context (1.2.1)
|
shoulda-context (1.2.1)
|
||||||
shoulda-matchers (2.7.0)
|
shoulda-matchers (2.7.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
sidekiq (3.5.0)
|
sidekiq (4.0.1)
|
||||||
celluloid (~> 0.17.0)
|
concurrent-ruby (~> 1.0)
|
||||||
connection_pool (~> 2.2, >= 2.2.0)
|
connection_pool (~> 2.2, >= 2.2.0)
|
||||||
json (~> 1.0)
|
json (~> 1.0)
|
||||||
redis (~> 3.2, >= 3.2.1)
|
redis (~> 3.2, >= 3.2.1)
|
||||||
redis-namespace (~> 1.5, >= 1.5.2)
|
sidekiq-statistic (1.2.0)
|
||||||
sidekiq-statistic (1.1.0)
|
sidekiq (>= 3.3.4, < 5)
|
||||||
sidekiq (~> 3.3, >= 3.3.4)
|
|
||||||
simple-rss (1.3.1)
|
simple-rss (1.3.1)
|
||||||
simplecov (0.10.0)
|
simplecov (0.10.0)
|
||||||
docile (~> 1.1.0)
|
docile (~> 1.1.0)
|
||||||
|
@ -427,8 +382,6 @@ GEM
|
||||||
thread_safe (0.3.5)
|
thread_safe (0.3.5)
|
||||||
tilt (1.4.1)
|
tilt (1.4.1)
|
||||||
timecop (0.8.0)
|
timecop (0.8.0)
|
||||||
timers (4.1.1)
|
|
||||||
hitimes
|
|
||||||
trollop (2.1.1)
|
trollop (2.1.1)
|
||||||
tzinfo (1.2.2)
|
tzinfo (1.2.2)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
|
@ -513,6 +466,7 @@ DEPENDENCIES
|
||||||
rb-inotify (~> 0.9)
|
rb-inotify (~> 0.9)
|
||||||
rbtrace
|
rbtrace
|
||||||
redis
|
redis
|
||||||
|
redis-namespace
|
||||||
rest-client
|
rest-client
|
||||||
rinku
|
rinku
|
||||||
rmmseg-cpp
|
rmmseg-cpp
|
||||||
|
|
|
@ -210,7 +210,7 @@ module Jobs
|
||||||
# If we are able to queue a job, do it
|
# If we are able to queue a job, do it
|
||||||
if SiteSetting.queue_jobs?
|
if SiteSetting.queue_jobs?
|
||||||
if opts[:delay_for].present?
|
if opts[:delay_for].present?
|
||||||
klass.delay_for(opts.delete(:delay_for)).delayed_perform(opts)
|
klass.perform_in(opts.delete(:delay_for), opts)
|
||||||
else
|
else
|
||||||
Sidekiq::Client.enqueue(klass, opts)
|
Sidekiq::Client.enqueue(klass, opts)
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,12 +6,12 @@ require 'sidekiq/testing'
|
||||||
describe Topic do
|
describe Topic do
|
||||||
|
|
||||||
def scheduled_jobs_for(job_name, params={})
|
def scheduled_jobs_for(job_name, params={})
|
||||||
Sidekiq::Extensions::DelayedClass.jobs.select do |job|
|
Sidekiq::Queues["default"].select do |job|
|
||||||
job_args = YAML.load(job['args'][0])
|
job_args = job['args'][0]
|
||||||
if job_args[0].to_s == "Jobs::#{job_name.to_s.camelcase}" and job_args[2] and job_args[2][0]
|
if job['class'] == "Jobs::#{job_name.to_s.camelcase}"
|
||||||
matched = true
|
matched = true
|
||||||
params.each do |key, value|
|
params.each do |key, value|
|
||||||
unless job_args[2][0][key] == value
|
unless job_args[key.to_s] == value
|
||||||
matched = false
|
matched = false
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -22,7 +22,10 @@ describe Topic do
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
before { SiteSetting.stubs(:queue_jobs).returns(true) }
|
before {
|
||||||
|
Sidekiq::Queues.clear_all
|
||||||
|
SiteSetting.queue_jobs = true
|
||||||
|
}
|
||||||
|
|
||||||
context 'creating a topic without auto-close' do
|
context 'creating a topic without auto-close' do
|
||||||
Given(:topic) { Fabricate(:topic, category: category) }
|
Given(:topic) { Fabricate(:topic, category: category) }
|
||||||
|
@ -41,6 +44,7 @@ describe Topic do
|
||||||
|
|
||||||
context 'jobs may be queued' do
|
context 'jobs may be queued' do
|
||||||
before do
|
before do
|
||||||
|
Sidekiq::Queues.clear_all
|
||||||
Timecop.freeze(Time.zone.now)
|
Timecop.freeze(Time.zone.now)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user