sidekiq-activerecord-shard 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/sidekiq-activerecord-shard/middleware.rb +2 -2
- data/lib/sidekiq-activerecord-shard/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 758bc7c30968cfc3961024118a4e4dd4f0bbefd4d99995ad7465f05691bac4eb
|
4
|
+
data.tar.gz: ae47127827bf9933229f22a3e104b698e2591e79acbba39e929b2515220bdb98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17fcce8d7723e936f85bc1a8d15448dc7ce89035f29cfc0f1f0d9484bae5793adf66d01c05dc2e00af36e576d1a01e12810ad103d75215d3d269a7be79b59248
|
7
|
+
data.tar.gz: fafdc2936270b3bc3237baa794559632977c304c69c01ff8057d5c6ea0379c57df8771cf9a0d9e7f32cc28c16b5ab290167e76e03192ff8ac2c46d04813d3500
|
data/README.md
CHANGED
@@ -23,10 +23,10 @@ Add follow code into `config/initializers/sidekiq-activerecord-shard.rb`:
|
|
23
23
|
SidekiqActiveRecordShard.configure do
|
24
24
|
self.selected_shard = -> do
|
25
25
|
case Current.tenant_id
|
26
|
-
when "
|
27
|
-
:
|
26
|
+
when "other"
|
27
|
+
:other
|
28
28
|
else
|
29
|
-
:
|
29
|
+
:primary
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -2,11 +2,11 @@ require "sidekiq"
|
|
2
2
|
|
3
3
|
module SidekiqActiveRecordShard
|
4
4
|
class Client
|
5
|
-
include
|
5
|
+
include Sidekiq::ClientMiddleware
|
6
6
|
|
7
7
|
def call(_jobclass, job, _queue, _redis)
|
8
8
|
# Store shard value in Job arguments
|
9
|
-
job["_active_record_shard"] = SidekiqActiveRecordShard.selected_shard.call
|
9
|
+
job["_active_record_shard"] = SidekiqActiveRecordShard.config.selected_shard.call
|
10
10
|
yield
|
11
11
|
end
|
12
12
|
end
|