pwwka 0.22.2 → 0.22.7.RC
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +66 -24
- data/.ruby-version +1 -1
- data/CODEOWNERS +1 -0
- data/Gemfile.rails-5.1 +1 -2
- data/Gemfile.rails-5.2 +1 -2
- data/Gemfile.rails-6.0 +7 -0
- data/lib/pwwka/channel_connector.rb +9 -4
- data/lib/pwwka/configuration.rb +8 -3
- data/lib/pwwka/transmitter.rb +18 -5
- data/lib/pwwka/version.rb +1 -1
- data/owners.json +1 -1
- data/pwwka.gemspec +1 -1
- data/spec/integration/send_and_receive_spec.rb +25 -5
- data/spec/unit/channel_connector_spec.rb +11 -1
- data/spec/unit/configuration_spec.rb +5 -1
- data/spec/unit/transmitter_spec.rb +7 -7
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 965ff1503560b0afd024c39ff93d9e1411e1cd928dd701a3bf41cd5116be5212
|
4
|
+
data.tar.gz: 0f0c8c330746ee727780759649c781aba69aa36d8c42904d9f3bdf8a044e5772
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43809503913bf7b18ae45ee3ecbcf26074e9182afb938262777782ff8a433191ed10461a6938a3db0d904e409dcb783df98a27a18d14723407eca56346ce7dd7
|
7
|
+
data.tar.gz: 9b6afecdce66ed9d36536c8f7eea142093fea738dcbc76225c72704d31e5a60e592cb9e3029dd57039dc0b228a39a5a1852ee6696bfbfe0ecfed4761bcdfea1a
|
data/.circleci/config.yml
CHANGED
@@ -3,16 +3,31 @@
|
|
3
3
|
---
|
4
4
|
version: 2
|
5
5
|
jobs:
|
6
|
-
|
6
|
+
release:
|
7
7
|
docker:
|
8
|
-
- image: circleci/ruby:2.
|
8
|
+
- image: circleci/ruby:2.7.1
|
9
|
+
steps:
|
10
|
+
- checkout
|
11
|
+
- run: bundle config stitchfix01.jfrog.io $ARTIFACTORY_USER:$ARTIFACTORY_TOKEN
|
12
|
+
- run: bundle install --full-index
|
13
|
+
- run:
|
14
|
+
name: Artifactory login
|
15
|
+
command: mkdir -p ~/.gem && curl -u$ARTIFACTORY_USER:$ARTIFACTORY_TOKEN https://stitchfix01.jfrog.io/stitchfix01/api/gems/eng-gems/api/v1/api_key.yaml
|
16
|
+
> ~/.gem/credentials && chmod 0600 ~/.gem/credentials
|
17
|
+
- run:
|
18
|
+
name: Build/release gem to artifactory
|
19
|
+
command: bundle exec rake push_artifactory
|
20
|
+
ruby-2.7.1-rails-6.0:
|
21
|
+
docker:
|
22
|
+
- image: circleci/ruby:2.7.1
|
9
23
|
environment:
|
10
|
-
BUNDLE_GEMFILE: Gemfile.rails-
|
24
|
+
BUNDLE_GEMFILE: Gemfile.rails-6.0
|
11
25
|
- image: redis:2.8.12
|
12
26
|
- image: rabbitmq:3.5.6
|
13
27
|
working_directory: "~/pwwka"
|
14
28
|
steps:
|
15
29
|
- checkout
|
30
|
+
- run: bundle config stitchfix01.jfrog.io $ARTIFACTORY_USER:$ARTIFACTORY_TOKEN
|
16
31
|
- run: bundle install --full-index
|
17
32
|
- run: bundle exec rspec --format RspecJunitFormatter --out /tmp/test-results/rspec.xml
|
18
33
|
--format=doc
|
@@ -22,20 +37,21 @@ jobs:
|
|
22
37
|
fi
|
23
38
|
- run:
|
24
39
|
name: Notify Pager Duty
|
25
|
-
command:
|
40
|
+
command: bundle exec y-notify "#eng-messaging-ops"
|
26
41
|
when: on_fail
|
27
42
|
- store_test_results:
|
28
43
|
path: "/tmp/test-results"
|
29
|
-
ruby-2.
|
44
|
+
ruby-2.6.6-rails-6.0:
|
30
45
|
docker:
|
31
|
-
- image: circleci/ruby:2.
|
46
|
+
- image: circleci/ruby:2.6.6
|
32
47
|
environment:
|
33
|
-
BUNDLE_GEMFILE: Gemfile.rails-
|
48
|
+
BUNDLE_GEMFILE: Gemfile.rails-6.0
|
34
49
|
- image: redis:2.8.12
|
35
50
|
- image: rabbitmq:3.5.6
|
36
51
|
working_directory: "~/pwwka"
|
37
52
|
steps:
|
38
53
|
- checkout
|
54
|
+
- run: bundle config stitchfix01.jfrog.io $ARTIFACTORY_USER:$ARTIFACTORY_TOKEN
|
39
55
|
- run: bundle install --full-index
|
40
56
|
- run: bundle exec rspec --format RspecJunitFormatter --out /tmp/test-results/rspec.xml
|
41
57
|
--format=doc
|
@@ -45,20 +61,21 @@ jobs:
|
|
45
61
|
fi
|
46
62
|
- run:
|
47
63
|
name: Notify Pager Duty
|
48
|
-
command:
|
64
|
+
command: bundle exec y-notify "#eng-messaging-ops"
|
49
65
|
when: on_fail
|
50
66
|
- store_test_results:
|
51
67
|
path: "/tmp/test-results"
|
52
|
-
ruby-2.
|
68
|
+
ruby-2.7.1-rails-5.2:
|
53
69
|
docker:
|
54
|
-
- image: circleci/ruby:2.
|
70
|
+
- image: circleci/ruby:2.7.1
|
55
71
|
environment:
|
56
|
-
BUNDLE_GEMFILE: Gemfile.rails-5.
|
72
|
+
BUNDLE_GEMFILE: Gemfile.rails-5.2
|
57
73
|
- image: redis:2.8.12
|
58
74
|
- image: rabbitmq:3.5.6
|
59
75
|
working_directory: "~/pwwka"
|
60
76
|
steps:
|
61
77
|
- checkout
|
78
|
+
- run: bundle config stitchfix01.jfrog.io $ARTIFACTORY_USER:$ARTIFACTORY_TOKEN
|
62
79
|
- run: bundle install --full-index
|
63
80
|
- run: bundle exec rspec --format RspecJunitFormatter --out /tmp/test-results/rspec.xml
|
64
81
|
--format=doc
|
@@ -68,20 +85,21 @@ jobs:
|
|
68
85
|
fi
|
69
86
|
- run:
|
70
87
|
name: Notify Pager Duty
|
71
|
-
command:
|
88
|
+
command: bundle exec y-notify "#eng-messaging-ops"
|
72
89
|
when: on_fail
|
73
90
|
- store_test_results:
|
74
91
|
path: "/tmp/test-results"
|
75
|
-
ruby-2.
|
92
|
+
ruby-2.6.6-rails-5.2:
|
76
93
|
docker:
|
77
|
-
- image: circleci/ruby:2.
|
94
|
+
- image: circleci/ruby:2.6.6
|
78
95
|
environment:
|
79
|
-
BUNDLE_GEMFILE: Gemfile.rails-5.
|
96
|
+
BUNDLE_GEMFILE: Gemfile.rails-5.2
|
80
97
|
- image: redis:2.8.12
|
81
98
|
- image: rabbitmq:3.5.6
|
82
99
|
working_directory: "~/pwwka"
|
83
100
|
steps:
|
84
101
|
- checkout
|
102
|
+
- run: bundle config stitchfix01.jfrog.io $ARTIFACTORY_USER:$ARTIFACTORY_TOKEN
|
85
103
|
- run: bundle install --full-index
|
86
104
|
- run: bundle exec rspec --format RspecJunitFormatter --out /tmp/test-results/rspec.xml
|
87
105
|
--format=doc
|
@@ -91,7 +109,7 @@ jobs:
|
|
91
109
|
fi
|
92
110
|
- run:
|
93
111
|
name: Notify Pager Duty
|
94
|
-
command:
|
112
|
+
command: bundle exec y-notify "#eng-messaging-ops"
|
95
113
|
when: on_fail
|
96
114
|
- store_test_results:
|
97
115
|
path: "/tmp/test-results"
|
@@ -99,14 +117,38 @@ workflows:
|
|
99
117
|
version: 2
|
100
118
|
on-commit:
|
101
119
|
jobs:
|
102
|
-
-
|
120
|
+
- release:
|
121
|
+
context: org-global
|
122
|
+
requires:
|
123
|
+
- ruby-2.7.1-rails-6.0
|
124
|
+
- ruby-2.6.6-rails-6.0
|
125
|
+
- ruby-2.7.1-rails-5.2
|
126
|
+
- ruby-2.6.6-rails-5.2
|
127
|
+
filters:
|
128
|
+
tags:
|
129
|
+
only: /^[0-9]+\.[0-9]+\.[0-9]+(\.?(RC|rc)[-\.]?\d*)?$/
|
130
|
+
branches:
|
131
|
+
ignore: /.*/
|
132
|
+
- ruby-2.7.1-rails-6.0:
|
103
133
|
context: org-global
|
104
|
-
|
134
|
+
filters:
|
135
|
+
tags:
|
136
|
+
only: &1 /.*/
|
137
|
+
- ruby-2.6.6-rails-6.0:
|
105
138
|
context: org-global
|
106
|
-
|
139
|
+
filters:
|
140
|
+
tags:
|
141
|
+
only: *1
|
142
|
+
- ruby-2.7.1-rails-5.2:
|
107
143
|
context: org-global
|
108
|
-
|
144
|
+
filters:
|
145
|
+
tags:
|
146
|
+
only: *1
|
147
|
+
- ruby-2.6.6-rails-5.2:
|
109
148
|
context: org-global
|
149
|
+
filters:
|
150
|
+
tags:
|
151
|
+
only: *1
|
110
152
|
scheduled:
|
111
153
|
triggers:
|
112
154
|
- schedule:
|
@@ -116,11 +158,11 @@ workflows:
|
|
116
158
|
only:
|
117
159
|
- master
|
118
160
|
jobs:
|
119
|
-
- ruby-2.
|
161
|
+
- ruby-2.7.1-rails-6.0:
|
120
162
|
context: org-global
|
121
|
-
- ruby-2.
|
163
|
+
- ruby-2.6.6-rails-6.0:
|
122
164
|
context: org-global
|
123
|
-
- ruby-2.
|
165
|
+
- ruby-2.7.1-rails-5.2:
|
124
166
|
context: org-global
|
125
|
-
- ruby-2.
|
167
|
+
- ruby-2.6.6-rails-5.2:
|
126
168
|
context: org-global
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.1
|
data/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @stitchfix/eng-messaging
|
data/Gemfile.rails-5.1
CHANGED
data/Gemfile.rails-5.2
CHANGED
data/Gemfile.rails-6.0
ADDED
@@ -19,15 +19,19 @@ module Pwwka
|
|
19
19
|
@connection = Bunny.new(configuration.rabbit_mq_host, connection_options)
|
20
20
|
@connection.start
|
21
21
|
rescue => e
|
22
|
-
logf "ERROR Connecting to RabbitMQ",
|
22
|
+
logf "ERROR Connecting to RabbitMQ: #{e}", at: :error
|
23
|
+
|
23
24
|
@connection.close if @connection
|
24
25
|
raise e
|
25
26
|
end
|
26
27
|
|
27
28
|
begin
|
28
29
|
@channel = @connection.create_channel
|
30
|
+
@channel.on_error do |ch, method|
|
31
|
+
logf "ERROR On RabbitMQ channel: #{method.inspect}"
|
32
|
+
end
|
29
33
|
rescue => e
|
30
|
-
logf "ERROR Opening RabbitMQ channel",
|
34
|
+
logf "ERROR Opening RabbitMQ channel: #{e}", at: :error
|
31
35
|
@connection.close if @connection
|
32
36
|
raise e
|
33
37
|
end
|
@@ -81,13 +85,14 @@ module Pwwka
|
|
81
85
|
begin
|
82
86
|
channel.close
|
83
87
|
rescue => e
|
84
|
-
logf "ERROR Closing RabbitMQ channel",
|
88
|
+
logf "ERROR Closing RabbitMQ channel: #{e}", at: :error
|
89
|
+
raise e
|
85
90
|
end
|
86
91
|
|
87
92
|
begin
|
88
93
|
connection.close
|
89
94
|
rescue => e
|
90
|
-
logf "ERROR Closing connection to RabbitMQ",
|
95
|
+
logf "ERROR Closing connection to RabbitMQ: #{e}", at: :error
|
91
96
|
raise e
|
92
97
|
end
|
93
98
|
end
|
data/lib/pwwka/configuration.rb
CHANGED
@@ -45,10 +45,15 @@ module Pwwka
|
|
45
45
|
def app_id
|
46
46
|
if @app_id.to_s.strip == ""
|
47
47
|
if defined?(Rails)
|
48
|
-
if Rails.respond_to?(:application)
|
49
|
-
|
48
|
+
if Rails.respond_to?(:application) && Rails.respond_to?(:version)
|
49
|
+
# Module#module_parent is the preferred technique, but we keep usage
|
50
|
+
# of the deprecated Module#parent for Rails 5 compatibility. see
|
51
|
+
# https://github.com/stitchfix/pwwka/issues/91 for context.
|
52
|
+
app_klass = Rails.application.class
|
53
|
+
app_parent = Rails.version =~ /^6/ ? app_klass.module_parent : app_klass.parent
|
54
|
+
app_parent.name
|
50
55
|
else
|
51
|
-
raise "'Rails' is defined, but it doesn't respond to #application, so could not derive the app_id; you must explicitly set it"
|
56
|
+
raise "'Rails' is defined, but it doesn't respond to #application or #version, so could not derive the app_id; you must explicitly set it"
|
52
57
|
end
|
53
58
|
else
|
54
59
|
raise "Could not derive the app_id; you must explicitly set it"
|
data/lib/pwwka/transmitter.rb
CHANGED
@@ -29,7 +29,7 @@ module Pwwka
|
|
29
29
|
@channel_connector = ChannelConnector.new(connection_name: "p: #{Pwwka.configuration.app_id} #{Pwwka.configuration.process_name}".strip)
|
30
30
|
end
|
31
31
|
|
32
|
-
# Send an important message that must go through. This method allows any raised exception
|
32
|
+
# Send an important message that must go through. This method allows any raised exception
|
33
33
|
# to pass through.
|
34
34
|
#
|
35
35
|
# payload:: Hash of what you'd like to include in your message
|
@@ -95,11 +95,24 @@ module Pwwka
|
|
95
95
|
job = Pwwka.configuration.async_job_klass
|
96
96
|
|
97
97
|
if background_job_processor == :resque
|
98
|
-
|
99
|
-
|
100
|
-
|
98
|
+
resque_args = [job, payload, routing_key]
|
99
|
+
|
100
|
+
unless type == nil && message_id == :auto_generate && headers == nil
|
101
|
+
# NOTE: (jdlubrano)
|
102
|
+
# Why can't we pass these options all of the time? Well, if a user
|
103
|
+
# of pwwka has configured their own async_job_klass that only has an
|
104
|
+
# arity of 2 (i.e. payload and routing key), then passing these options
|
105
|
+
# as an additional argument would break the user's application. In
|
106
|
+
# order to maintain compatibility with preceding versions of Pwwka,
|
107
|
+
# we need to ensure that the same arguments passed into this method
|
108
|
+
# result in compatible calls to enqueue any Resque jobs.
|
109
|
+
resque_args << { type: type, message_id: message_id, headers: headers }
|
110
|
+
end
|
111
|
+
|
112
|
+
if delay_by_ms.zero?
|
113
|
+
Resque.enqueue(*resque_args)
|
101
114
|
else
|
102
|
-
Resque.enqueue_in(delay_by_ms/1000,
|
115
|
+
Resque.enqueue_in(delay_by_ms/1000, *resque_args)
|
103
116
|
end
|
104
117
|
elsif background_job_processor == :sidekiq
|
105
118
|
options = { delay_by_ms: delay_by_ms, type: type, message_id: message_id, headers: headers }
|
data/lib/pwwka/version.rb
CHANGED
data/owners.json
CHANGED
data/pwwka.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_development_dependency("rake")
|
27
27
|
s.add_development_dependency("rspec")
|
28
28
|
s.add_development_dependency("resque")
|
29
|
-
s.add_development_dependency("resque-retry")
|
29
|
+
s.add_development_dependency("resque-retry", "~> 1.5.3")
|
30
30
|
s.add_development_dependency("sidekiq")
|
31
31
|
s.add_development_dependency("simplecov")
|
32
32
|
s.add_development_dependency("resqutils")
|
@@ -11,6 +11,9 @@ describe "sending and receiving messages", :integration do
|
|
11
11
|
include IntegrationTestHelpers
|
12
12
|
include Resqutils::Spec::ResqueHelpers
|
13
13
|
|
14
|
+
let(:async_resque_queue) { 'pwwka_send_message_async' }
|
15
|
+
let(:delayed_resque_queue) { :delayed }
|
16
|
+
|
14
17
|
before do
|
15
18
|
ENV["JOB_KLASS"] = MyTestJob.name
|
16
19
|
ENV["PWWKA_QUEUE_EXTENDED_INFO"] = "true"
|
@@ -30,7 +33,8 @@ describe "sending and receiving messages", :integration do
|
|
30
33
|
FooReceiver.reset!
|
31
34
|
MultiRoutingReceived.reset!
|
32
35
|
OtherFooReceiver.reset!
|
33
|
-
clear_queue(
|
36
|
+
clear_queue(async_resque_queue)
|
37
|
+
clear_queue(delayed_resque_queue)
|
34
38
|
clear_queue(MyTestJob)
|
35
39
|
end
|
36
40
|
|
@@ -144,7 +148,7 @@ describe "sending and receiving messages", :integration do
|
|
144
148
|
|
145
149
|
expect(AllReceiver.messages_received.size).to eq(0)
|
146
150
|
|
147
|
-
process_resque_job(Pwwka::SendMessageAsyncJob
|
151
|
+
process_resque_job(Pwwka::SendMessageAsyncJob, async_resque_queue)
|
148
152
|
|
149
153
|
allow_receivers_to_process_queues
|
150
154
|
|
@@ -166,7 +170,7 @@ describe "sending and receiving messages", :integration do
|
|
166
170
|
|
167
171
|
expect(AllReceiver.messages_received.size).to eq(0)
|
168
172
|
|
169
|
-
process_resque_job(Pwwka::SendMessageAsyncJob
|
173
|
+
process_resque_job(Pwwka::SendMessageAsyncJob, async_resque_queue)
|
170
174
|
|
171
175
|
allow_receivers_to_process_queues
|
172
176
|
|
@@ -186,12 +190,28 @@ describe "sending and receiving messages", :integration do
|
|
186
190
|
|
187
191
|
allow(Pwwka).to receive(:configuration).and_return(configuration)
|
188
192
|
|
189
|
-
allow(Resque).to receive(:
|
193
|
+
allow(Resque).to receive(:enqueue)
|
190
194
|
|
191
195
|
Pwwka::Transmitter.send_message_async({ sample: "payload", has: { deeply: true, nested: 4 }},
|
192
196
|
"pwwka.testing.bar")
|
193
197
|
|
194
|
-
expect(Resque).to have_received(:
|
198
|
+
expect(Resque).to have_received(:enqueue).with(async_job_klass, anything, anything)
|
199
|
+
end
|
200
|
+
|
201
|
+
it "can queue a job to send a message with a delay" do
|
202
|
+
Pwwka::Transmitter.send_message_async({ sample: "payload" },
|
203
|
+
"pwwka.testing.bar",
|
204
|
+
delay_by_ms: 1)
|
205
|
+
|
206
|
+
allow_receivers_to_process_queues # not expecting anything to be processed
|
207
|
+
|
208
|
+
expect(AllReceiver.messages_received.size).to eq(0)
|
209
|
+
|
210
|
+
process_resque_job(Pwwka::SendMessageAsyncJob, delayed_resque_queue)
|
211
|
+
|
212
|
+
allow_receivers_to_process_queues
|
213
|
+
|
214
|
+
expect(AllReceiver.messages_received.size).to eq(1)
|
195
215
|
end
|
196
216
|
end
|
197
217
|
|
@@ -14,6 +14,7 @@ describe Pwwka::ChannelConnector do
|
|
14
14
|
allow(bunny_session).to receive(:start)
|
15
15
|
allow(bunny_session).to receive(:close)
|
16
16
|
allow(bunny_session).to receive(:create_channel).and_return(bunny_channel)
|
17
|
+
allow(bunny_channel).to receive(:on_error)
|
17
18
|
end
|
18
19
|
|
19
20
|
it "sets a prefetch value if configured to do so" do
|
@@ -22,6 +23,11 @@ describe Pwwka::ChannelConnector do
|
|
22
23
|
described_class.new(prefetch: 10)
|
23
24
|
end
|
24
25
|
|
26
|
+
it "sets an on_error handler" do
|
27
|
+
expect(bunny_channel).to receive(:on_error)
|
28
|
+
described_class.new
|
29
|
+
end
|
30
|
+
|
25
31
|
it "does not set a prefetch value unless configured" do
|
26
32
|
expect(bunny_channel).not_to receive(:prefetch).with(10)
|
27
33
|
|
@@ -67,10 +73,14 @@ describe Pwwka::ChannelConnector do
|
|
67
73
|
end
|
68
74
|
|
69
75
|
describe "raise_if_delayed_not_allowed" do
|
76
|
+
let(:bunny_channel) { instance_double(Bunny::Channel) }
|
77
|
+
|
70
78
|
before do
|
71
79
|
allow(Bunny).to receive(:new).and_return(bunny_session)
|
72
80
|
allow(bunny_session).to receive(:start)
|
73
|
-
allow(bunny_session).to receive(:
|
81
|
+
allow(bunny_session).to receive(:close)
|
82
|
+
allow(bunny_session).to receive(:create_channel).and_return(bunny_channel)
|
83
|
+
allow(bunny_channel).to receive(:on_error)
|
74
84
|
@default_allow_delayed = Pwwka.configuration.options[:allow_delayed]
|
75
85
|
end
|
76
86
|
|
@@ -75,6 +75,10 @@ describe Pwwka::Configuration do
|
|
75
75
|
def self.application
|
76
76
|
MyAmazingApp::Application.new
|
77
77
|
end
|
78
|
+
|
79
|
+
def self.version
|
80
|
+
'5.2.0'
|
81
|
+
end
|
78
82
|
end
|
79
83
|
Object.const_set("Rails",rails)
|
80
84
|
end
|
@@ -97,7 +101,7 @@ describe Pwwka::Configuration do
|
|
97
101
|
it "blows up when not set" do
|
98
102
|
expect {
|
99
103
|
configuration.app_id
|
100
|
-
}.to raise_error(/'Rails' is defined, but it doesn't respond to #application, so could not derive the app_id; you must explicitly set it/)
|
104
|
+
}.to raise_error(/'Rails' is defined, but it doesn't respond to #application or #version, so could not derive the app_id; you must explicitly set it/)
|
101
105
|
end
|
102
106
|
end
|
103
107
|
end
|
@@ -312,19 +312,19 @@ describe Pwwka::Transmitter do
|
|
312
312
|
end
|
313
313
|
context "on_error: :resque" do
|
314
314
|
it "queues a Resque job" do
|
315
|
-
allow(Resque).to receive(:
|
315
|
+
allow(Resque).to receive(:enqueue)
|
316
316
|
described_class.send_message!(payload,routing_key, on_error: :resque)
|
317
|
-
expect(Resque).to have_received(:
|
317
|
+
expect(Resque).to have_received(:enqueue).with(Pwwka::SendMessageAsyncJob,payload,routing_key)
|
318
318
|
end
|
319
319
|
context "when there is a problem queueing the resque job" do
|
320
320
|
it "raises the original exception job" do
|
321
|
-
allow(Resque).to receive(:
|
321
|
+
allow(Resque).to receive(:enqueue).and_raise("NOPE")
|
322
322
|
expect {
|
323
323
|
described_class.send_message!(payload,routing_key, on_error: :resque)
|
324
324
|
}.to raise_error(/OH NOES/)
|
325
325
|
end
|
326
326
|
it "logs the Resque error as a warning" do
|
327
|
-
allow(Resque).to receive(:
|
327
|
+
allow(Resque).to receive(:enqueue).and_raise("NOPE")
|
328
328
|
begin
|
329
329
|
described_class.send_message!(payload,routing_key, on_error: :resque)
|
330
330
|
rescue => ex
|
@@ -338,18 +338,18 @@ describe Pwwka::Transmitter do
|
|
338
338
|
context "when configured background_job_processor is Resque" do
|
339
339
|
context "when the job is queued successfully" do
|
340
340
|
before do
|
341
|
-
allow(Resque).to receive(:
|
341
|
+
allow(Resque).to receive(:enqueue)
|
342
342
|
end
|
343
343
|
|
344
344
|
it "queues a Resque job" do
|
345
345
|
described_class.send_message!(payload, routing_key, on_error: :retry_async)
|
346
|
-
expect(Resque).to have_received(:
|
346
|
+
expect(Resque).to have_received(:enqueue).with(Pwwka::SendMessageAsyncJob, payload, routing_key)
|
347
347
|
end
|
348
348
|
end
|
349
349
|
|
350
350
|
context "when there is a problem queueing the Resque job" do
|
351
351
|
before do
|
352
|
-
allow(Resque).to receive(:
|
352
|
+
allow(Resque).to receive(:enqueue).and_raise("NOPE")
|
353
353
|
end
|
354
354
|
|
355
355
|
it "raises the original exception job" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwwka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.22.
|
4
|
+
version: 0.22.7.RC
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stitch Fix Engineering
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date:
|
18
|
+
date: 2020-06-10 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: bunny
|
@@ -119,16 +119,16 @@ dependencies:
|
|
119
119
|
name: resque-retry
|
120
120
|
requirement: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 1.5.3
|
125
125
|
type: :development
|
126
126
|
prerelease: false
|
127
127
|
version_requirements: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 1.5.3
|
132
132
|
- !ruby/object:Gem::Dependency
|
133
133
|
name: sidekiq
|
134
134
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,6 +235,7 @@ files:
|
|
235
235
|
- ".ruby-gemset"
|
236
236
|
- ".ruby-version"
|
237
237
|
- ".travis.yml"
|
238
|
+
- CODEOWNERS
|
238
239
|
- CODE_OF_CONDUCT.md
|
239
240
|
- CONTRIBUTING.md
|
240
241
|
- Gemfile
|
@@ -242,6 +243,7 @@ files:
|
|
242
243
|
- Gemfile.rails-5.0
|
243
244
|
- Gemfile.rails-5.1
|
244
245
|
- Gemfile.rails-5.2
|
246
|
+
- Gemfile.rails-6.0
|
245
247
|
- LICENSE
|
246
248
|
- README.md
|
247
249
|
- Rakefile
|
@@ -313,12 +315,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
313
315
|
version: '0'
|
314
316
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
315
317
|
requirements:
|
316
|
-
- - "
|
318
|
+
- - ">"
|
317
319
|
- !ruby/object:Gem::Version
|
318
|
-
version:
|
320
|
+
version: 1.3.1
|
319
321
|
requirements: []
|
320
|
-
|
321
|
-
rubygems_version: 2.7.6
|
322
|
+
rubygems_version: 3.1.2
|
322
323
|
signing_key:
|
323
324
|
specification_version: 4
|
324
325
|
summary: Send and receive messages via RabbitMQ
|