multiple_man_sidekiq 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f520d675d7ac188ff4388dc0be7f69af2db22321
|
4
|
+
data.tar.gz: 69cac6997fbc895958aaa2e790ee8f1bb989ad4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e03d4ce118de6eff69a26dc02ec7b2e5fd4507abd3ba5c62a47846e31e667b5ddb85af8b1674106ee6d8795c74a5268217f13351b6db7991ba3236cdf707bb95
|
7
|
+
data.tar.gz: a87b47ae2f4b4f930098a0a4016483de7c410a297ac76bae862d1e83284036192d2dbcf7412ba26e40bd12388d5fac17d8653afbaccf26fc0554aa5c4fb565b7
|
@@ -14,7 +14,10 @@ module MultipleMan
|
|
14
14
|
klass = records.class.name
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
# Split jobs into parts so sidekiq doesn't need to deal with enormous seed jobs.
|
18
|
+
ids.each_slice(1000) do |ids|
|
19
|
+
ModelPublisherJob.perform_async(klass, ids, options, operation)
|
20
|
+
end
|
18
21
|
end
|
19
22
|
|
20
23
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module MultipleMan
|
2
|
+
class SidekiqMiddleware
|
3
|
+
def call(worker, job, queue)
|
4
|
+
establish_channel if is_middleman_job?
|
5
|
+
yield
|
6
|
+
ensure
|
7
|
+
close_channel if is_middleman_job?
|
8
|
+
end
|
9
|
+
|
10
|
+
def establish_channel
|
11
|
+
Thread.local[:multiple_man_connection] = MultipleMan::Connection.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def close_channel
|
15
|
+
connection = Thread.local[:multiple_man_connection]
|
16
|
+
connection.close_channel if connection && connection.open_channel?
|
17
|
+
end
|
18
|
+
|
19
|
+
def is_middleman_job?
|
20
|
+
worker.kind_of? MultipleMan::ModelPublisherJob
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multiple_man_sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Brunner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- Rakefile
|
82
82
|
- lib/multiple_man_sidekiq.rb
|
83
83
|
- lib/multiple_man_sidekiq/async_model_publisher.rb
|
84
|
+
- lib/multiple_man_sidekiq/middleware/sidekiq_middleware.rb
|
84
85
|
- lib/multiple_man_sidekiq/mixins/async_publisher.rb
|
85
86
|
- lib/multiple_man_sidekiq/version.rb
|
86
87
|
- multiple_man_sidekiq.gemspec
|