pwwka 0.22.6 → 0.22.7.RC

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 282868c5e4071c9ad47f0f4c553cf78ff177606af19105660fa25346645c1dce
4
- data.tar.gz: b3d27d5902acbc6436cedbf901d6f80421a4b562dadee3bcb54e4786670c4485
3
+ metadata.gz: 965ff1503560b0afd024c39ff93d9e1411e1cd928dd701a3bf41cd5116be5212
4
+ data.tar.gz: 0f0c8c330746ee727780759649c781aba69aa36d8c42904d9f3bdf8a044e5772
5
5
  SHA512:
6
- metadata.gz: fc55c0a0ba5732e12673cdd88b2c094d670a9d96e55e37498ce0ab099974990983427674e8df2ae095580472d94ae300479bb276cd18713e1eabcb6b834661f2
7
- data.tar.gz: fb8d23c0bc7e4f91798f25387c6384c5e36c5edb80a00c2b304ae17f2504ea4f008a3c9df0ee763f2c27fe997ae95b24293814e24d7179fcfc488f6810ffb481
6
+ metadata.gz: 43809503913bf7b18ae45ee3ecbcf26074e9182afb938262777782ff8a433191ed10461a6938a3db0d904e409dcb783df98a27a18d14723407eca56346ce7dd7
7
+ data.tar.gz: 9b6afecdce66ed9d36536c8f7eea142093fea738dcbc76225c72704d31e5a60e592cb9e3029dd57039dc0b228a39a5a1852ee6696bfbfe0ecfed4761bcdfea1a
@@ -5,7 +5,7 @@ version: 2
5
5
  jobs:
6
6
  release:
7
7
  docker:
8
- - image: circleci/ruby:2.6.4
8
+ - image: circleci/ruby:2.7.1
9
9
  steps:
10
10
  - checkout
11
11
  - run: bundle config stitchfix01.jfrog.io $ARTIFACTORY_USER:$ARTIFACTORY_TOKEN
@@ -17,9 +17,9 @@ jobs:
17
17
  - run:
18
18
  name: Build/release gem to artifactory
19
19
  command: bundle exec rake push_artifactory
20
- ruby-2.6.4-rails-6.0:
20
+ ruby-2.7.1-rails-6.0:
21
21
  docker:
22
- - image: circleci/ruby:2.6.4
22
+ - image: circleci/ruby:2.7.1
23
23
  environment:
24
24
  BUNDLE_GEMFILE: Gemfile.rails-6.0
25
25
  - image: redis:2.8.12
@@ -37,13 +37,13 @@ jobs:
37
37
  fi
38
38
  - run:
39
39
  name: Notify Pager Duty
40
- command: bundle exec y-notify "#eng-platform-alerts"
40
+ command: bundle exec y-notify "#eng-messaging-ops"
41
41
  when: on_fail
42
42
  - store_test_results:
43
43
  path: "/tmp/test-results"
44
- ruby-2.5.6-rails-6.0:
44
+ ruby-2.6.6-rails-6.0:
45
45
  docker:
46
- - image: circleci/ruby:2.5.6
46
+ - image: circleci/ruby:2.6.6
47
47
  environment:
48
48
  BUNDLE_GEMFILE: Gemfile.rails-6.0
49
49
  - image: redis:2.8.12
@@ -61,13 +61,13 @@ jobs:
61
61
  fi
62
62
  - run:
63
63
  name: Notify Pager Duty
64
- command: bundle exec y-notify "#eng-platform-alerts"
64
+ command: bundle exec y-notify "#eng-messaging-ops"
65
65
  when: on_fail
66
66
  - store_test_results:
67
67
  path: "/tmp/test-results"
68
- ruby-2.6.4-rails-5.2:
68
+ ruby-2.7.1-rails-5.2:
69
69
  docker:
70
- - image: circleci/ruby:2.6.4
70
+ - image: circleci/ruby:2.7.1
71
71
  environment:
72
72
  BUNDLE_GEMFILE: Gemfile.rails-5.2
73
73
  - image: redis:2.8.12
@@ -85,13 +85,13 @@ jobs:
85
85
  fi
86
86
  - run:
87
87
  name: Notify Pager Duty
88
- command: bundle exec y-notify "#eng-platform-alerts"
88
+ command: bundle exec y-notify "#eng-messaging-ops"
89
89
  when: on_fail
90
90
  - store_test_results:
91
91
  path: "/tmp/test-results"
92
- ruby-2.5.6-rails-5.2:
92
+ ruby-2.6.6-rails-5.2:
93
93
  docker:
94
- - image: circleci/ruby:2.5.6
94
+ - image: circleci/ruby:2.6.6
95
95
  environment:
96
96
  BUNDLE_GEMFILE: Gemfile.rails-5.2
97
97
  - image: redis:2.8.12
@@ -109,7 +109,7 @@ jobs:
109
109
  fi
110
110
  - run:
111
111
  name: Notify Pager Duty
112
- command: bundle exec y-notify "#eng-platform-alerts"
112
+ command: bundle exec y-notify "#eng-messaging-ops"
113
113
  when: on_fail
114
114
  - store_test_results:
115
115
  path: "/tmp/test-results"
@@ -120,31 +120,31 @@ workflows:
120
120
  - release:
121
121
  context: org-global
122
122
  requires:
123
- - ruby-2.6.4-rails-6.0
124
- - ruby-2.5.6-rails-6.0
125
- - ruby-2.6.4-rails-5.2
126
- - ruby-2.5.6-rails-5.2
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
127
  filters:
128
128
  tags:
129
- only: /^[0-9]+\.[0-9]+\.[0-9]+(\.?RC[-\.]?\d*)?$/
129
+ only: /^[0-9]+\.[0-9]+\.[0-9]+(\.?(RC|rc)[-\.]?\d*)?$/
130
130
  branches:
131
131
  ignore: /.*/
132
- - ruby-2.6.4-rails-6.0:
132
+ - ruby-2.7.1-rails-6.0:
133
133
  context: org-global
134
134
  filters:
135
135
  tags:
136
136
  only: &1 /.*/
137
- - ruby-2.5.6-rails-6.0:
137
+ - ruby-2.6.6-rails-6.0:
138
138
  context: org-global
139
139
  filters:
140
140
  tags:
141
141
  only: *1
142
- - ruby-2.6.4-rails-5.2:
142
+ - ruby-2.7.1-rails-5.2:
143
143
  context: org-global
144
144
  filters:
145
145
  tags:
146
146
  only: *1
147
- - ruby-2.5.6-rails-5.2:
147
+ - ruby-2.6.6-rails-5.2:
148
148
  context: org-global
149
149
  filters:
150
150
  tags:
@@ -158,11 +158,11 @@ workflows:
158
158
  only:
159
159
  - master
160
160
  jobs:
161
- - ruby-2.6.4-rails-6.0:
161
+ - ruby-2.7.1-rails-6.0:
162
162
  context: org-global
163
- - ruby-2.5.6-rails-6.0:
163
+ - ruby-2.6.6-rails-6.0:
164
164
  context: org-global
165
- - ruby-2.6.4-rails-5.2:
165
+ - ruby-2.7.1-rails-5.2:
166
166
  context: org-global
167
- - ruby-2.5.6-rails-5.2:
167
+ - ruby-2.6.6-rails-5.2:
168
168
  context: org-global
@@ -1 +1 @@
1
- 2.5.1
1
+ 2.7.1
@@ -0,0 +1 @@
1
+ * @stitchfix/eng-messaging
@@ -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
- # Be perhaps too carefully making sure we queue jobs in the legacy way
99
- if type == nil && message_id == :auto_generate && headers == nil
100
- Resque.enqueue_in(delay_by_ms/1000, job, payload, routing_key)
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, job, payload, routing_key, type: type, message_id: message_id, headers: headers)
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 }
@@ -1,4 +1,4 @@
1
1
  module Pwwka
2
- VERSION = '0.22.6'
2
+ VERSION = '0.22.7.RC'
3
3
  end
4
4
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "owners": [
3
3
  {
4
- "team": "platform"
4
+ "team": "messaging"
5
5
  }
6
6
  ]
7
7
  }
@@ -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(:delayed)
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,:delayed)
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,:delayed)
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(:enqueue_in)
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(:enqueue_in).with(anything, async_job_klass, anything, anything)
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
 
@@ -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(:enqueue_in)
315
+ allow(Resque).to receive(:enqueue)
316
316
  described_class.send_message!(payload,routing_key, on_error: :resque)
317
- expect(Resque).to have_received(:enqueue_in).with(0,Pwwka::SendMessageAsyncJob,payload,routing_key)
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(:enqueue_in).and_raise("NOPE")
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(:enqueue_in).and_raise("NOPE")
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(:enqueue_in)
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(:enqueue_in).with(0, Pwwka::SendMessageAsyncJob, payload, routing_key)
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(:enqueue_in).and_raise("NOPE")
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.6
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: 2019-09-11 00:00:00.000000000 Z
18
+ date: 2020-06-10 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: bunny
@@ -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
@@ -314,11 +315,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
314
315
  version: '0'
315
316
  required_rubygems_version: !ruby/object:Gem::Requirement
316
317
  requirements:
317
- - - ">="
318
+ - - ">"
318
319
  - !ruby/object:Gem::Version
319
- version: '0'
320
+ version: 1.3.1
320
321
  requirements: []
321
- rubygems_version: 3.0.3
322
+ rubygems_version: 3.1.2
322
323
  signing_key:
323
324
  specification_version: 4
324
325
  summary: Send and receive messages via RabbitMQ