gitlab-mail_room 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mail_room/delivery/sidekiq.rb +4 -3
- data/lib/mail_room/version.rb +1 -1
- data/spec/lib/delivery/sidekiq_spec.rb +29 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c08c7fc259366a99916418eb7487ad88670c1003533fd372b8314c1f4026fc19
|
4
|
+
data.tar.gz: c6500d0249a3c59c62af80939a9018609e92b7347119ff61f11a292bb704cbd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95df5a25eb397d315458cb841417f610c3d32d8145504a6899bc7377b99083fd3da56dc9fa4953ffe463702d0c1dd4ddc118a98562ba7400f1dac8ed780adb40
|
7
|
+
data.tar.gz: 28ee5cfc4e792023e76ea89b64728e24229b14510270eec56d0e52d8fdefffd282f57f9a2b7e8b10c6c95b4a1e6210044634d84e7ef3ac52914313a450ac3313
|
@@ -8,16 +8,17 @@ module MailRoom
|
|
8
8
|
# Sidekiq Delivery method
|
9
9
|
# @author Douwe Maan
|
10
10
|
class Sidekiq
|
11
|
-
Options = Struct.new(:redis_url, :namespace, :sentinels, :queue, :worker, :logger) do
|
11
|
+
Options = Struct.new(:redis_url, :namespace, :sentinels, :queue, :worker, :logger, :redis_db) do
|
12
12
|
def initialize(mailbox)
|
13
13
|
redis_url = mailbox.delivery_options[:redis_url] || "redis://localhost:6379"
|
14
|
+
redis_db = mailbox.delivery_options[:redis_db] || 0
|
14
15
|
namespace = mailbox.delivery_options[:namespace]
|
15
16
|
sentinels = mailbox.delivery_options[:sentinels]
|
16
17
|
queue = mailbox.delivery_options[:queue] || "default"
|
17
18
|
worker = mailbox.delivery_options[:worker]
|
18
19
|
logger = mailbox.logger
|
19
20
|
|
20
|
-
super(redis_url, namespace, sentinels, queue, worker, logger)
|
21
|
+
super(redis_url, namespace, sentinels, queue, worker, logger, redis_db)
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
@@ -45,7 +46,7 @@ module MailRoom
|
|
45
46
|
def client
|
46
47
|
@client ||= begin
|
47
48
|
sentinels = options.sentinels
|
48
|
-
redis_options = { url: options.redis_url }
|
49
|
+
redis_options = { url: options.redis_url, db: options.redis_db }
|
49
50
|
redis_options[:sentinels] = sentinels if sentinels
|
50
51
|
|
51
52
|
redis = ::Redis.new(redis_options)
|
data/lib/mail_room/version.rb
CHANGED
@@ -8,23 +8,45 @@ describe MailRoom::Delivery::Sidekiq do
|
|
8
8
|
|
9
9
|
describe '#options' do
|
10
10
|
let(:redis_url) { 'redis://localhost' }
|
11
|
+
let(:redis_options) { { redis_url: redis_url } }
|
11
12
|
|
12
13
|
context 'when only redis_url is specified' do
|
13
14
|
let(:mailbox) {
|
14
15
|
build_mailbox(
|
15
16
|
delivery_method: :sidekiq,
|
16
|
-
delivery_options:
|
17
|
-
redis_url: redis_url
|
18
|
-
}
|
17
|
+
delivery_options: redis_options
|
19
18
|
)
|
20
19
|
}
|
21
20
|
|
22
|
-
|
23
|
-
|
21
|
+
context 'with simple redis url' do
|
22
|
+
it 'client has same specified redis_url' do
|
23
|
+
expect(redis.client.options[:url]).to eq(redis_url)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'client is a instance of RedisNamespace class' do
|
27
|
+
expect(redis).to be_a ::Redis
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'connection has correct values' do
|
31
|
+
expect(redis.connection[:host]).to eq('localhost')
|
32
|
+
expect(redis.connection[:db]).to eq(0)
|
33
|
+
end
|
24
34
|
end
|
25
35
|
|
26
|
-
|
27
|
-
|
36
|
+
context 'with redis_db specified in options' do
|
37
|
+
before do
|
38
|
+
redis_options[:redis_db] = 4
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'client has correct redis_url' do
|
42
|
+
expect(redis.client.options[:url]).to eq(redis_url)
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
it 'connection has correct values' do
|
47
|
+
expect(redis.connection[:host]).to eq('localhost')
|
48
|
+
expect(redis.connection[:db]).to eq(4)
|
49
|
+
end
|
28
50
|
end
|
29
51
|
end
|
30
52
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-mail_room
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Pitale
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-imap
|