pwwka 0.22.3 → 0.22.7

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
  SHA256:
3
- metadata.gz: 2671782bb95ef71a6afbe4908d3652238dbb801091b9fce6823e9f7a7061750c
4
- data.tar.gz: 6c44c128ea03d6ffb0d9858bf56c4b38ac004f829167761549f3051a82903c48
3
+ metadata.gz: db6a80c2598afc2264f985779fd52a6bfed9b2e6a9aa3d0b4859a26ad242e916
4
+ data.tar.gz: ea64e44b4ec47eb2b9586a03f546546dde67d86df3e2bf5ff6b1b9976b458eea
5
5
  SHA512:
6
- metadata.gz: d88737eeed3ecb7b8eeab1a174dc574dbf38755cae27a374d2cb20841e157e05cc971c5467f81b227cc14389b2b89381da15902de67b5118b498f026b4c5d7a5
7
- data.tar.gz: c414a254d881bbf7723ec31a94cfea7f5d46a4d2afc7f527c8e2b4d1d5c02a92d663ec12f422fa444c47e8950edb130285c5c057364b83b2bb70b39b6ed58bd2
6
+ metadata.gz: f65ded4e96afa7bf2a3c90d7aad3392c8089d10cf9b65a98c5fa71f89bbab66643d83d7e9a20267f9fc06e78d2f46ffd0805889fb81db53021da774e7fb76178
7
+ data.tar.gz: 99c3386a1f87d5833e4c916b82151007265bf3ec7455057831f1e9efb8651e5570f85eacfaedd69b978fe1a4129b65a07df1eb8e152b08cd2086c1a0addc6151
@@ -3,16 +3,31 @@
3
3
  ---
4
4
  version: 2
5
5
  jobs:
6
- ruby-2.5.3-rails-5.2:
6
+ release:
7
7
  docker:
8
- - image: circleci/ruby:2.5.3
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-5.2
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: 'bundle exec y-notify #eng-platform'
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.4.5-rails-5.2:
44
+ ruby-2.6.6-rails-6.0:
30
45
  docker:
31
- - image: circleci/ruby:2.4.5
46
+ - image: circleci/ruby:2.6.6
32
47
  environment:
33
- BUNDLE_GEMFILE: Gemfile.rails-5.2
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: 'bundle exec y-notify #eng-platform'
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.5.3-rails-5.1:
68
+ ruby-2.7.1-rails-5.2:
53
69
  docker:
54
- - image: circleci/ruby:2.5.3
70
+ - image: circleci/ruby:2.7.1
55
71
  environment:
56
- BUNDLE_GEMFILE: Gemfile.rails-5.1
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: 'bundle exec y-notify #eng-platform'
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.4.5-rails-5.1:
92
+ ruby-2.6.6-rails-5.2:
76
93
  docker:
77
- - image: circleci/ruby:2.4.5
94
+ - image: circleci/ruby:2.6.6
78
95
  environment:
79
- BUNDLE_GEMFILE: Gemfile.rails-5.1
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: 'bundle exec y-notify #eng-platform'
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
- - ruby-2.5.3-rails-5.2:
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
- - ruby-2.4.5-rails-5.2:
134
+ filters:
135
+ tags:
136
+ only: &1 /.*/
137
+ - ruby-2.6.6-rails-6.0:
105
138
  context: org-global
106
- - ruby-2.5.3-rails-5.1:
139
+ filters:
140
+ tags:
141
+ only: *1
142
+ - ruby-2.7.1-rails-5.2:
107
143
  context: org-global
108
- - ruby-2.4.5-rails-5.1:
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.5.3-rails-5.2:
161
+ - ruby-2.7.1-rails-6.0:
120
162
  context: org-global
121
- - ruby-2.4.5-rails-5.2:
163
+ - ruby-2.6.6-rails-6.0:
122
164
  context: org-global
123
- - ruby-2.5.3-rails-5.1:
165
+ - ruby-2.7.1-rails-5.2:
124
166
  context: org-global
125
- - ruby-2.4.5-rails-5.1:
167
+ - ruby-2.6.6-rails-5.2:
126
168
  context: org-global
@@ -1 +1 @@
1
- 2.5.1
1
+ 2.7.1
@@ -0,0 +1 @@
1
+ * @stitchfix/eng-messaging
@@ -1,7 +1,6 @@
1
1
  # DO NOT MODIFY - this is managed by Git Reduce in goro
2
2
  #
3
- source 'https://gem.fury.io/me/'
4
- source 'https://www.rubygems.org'
3
+ source 'https://stitchfix01.jfrog.io/stitchfix01/api/gems/eng-gems/'
5
4
 
6
5
  gemspec
7
6
 
@@ -1,7 +1,6 @@
1
1
  # DO NOT MODIFY - this is managed by Git Reduce in goro
2
2
  #
3
- source 'https://gem.fury.io/me/'
4
- source 'https://www.rubygems.org'
3
+ source 'https://stitchfix01.jfrog.io/stitchfix01/api/gems/eng-gems/'
5
4
 
6
5
  gemspec
7
6
 
@@ -0,0 +1,7 @@
1
+ # DO NOT MODIFY - this is managed by Git Reduce in goro
2
+ #
3
+ source 'https://stitchfix01.jfrog.io/stitchfix01/api/gems/eng-gems/'
4
+
5
+ gemspec
6
+
7
+ gem 'activesupport', '~> 6.0.0'
data/README.md CHANGED
@@ -148,8 +148,8 @@ Pwwka::Transmitter.send_message!(payload, routing_key, on_error: :ignore)
148
148
 
149
149
  #### Delayed Messages
150
150
 
151
- You might want to delay sending a message (for example, if you have just created a database
152
- record and a race condition keeps catching you out). In that case you can use delayed message
151
+ You might want to delay sending a message (for example, if you have just created a database
152
+ record and a race condition keeps catching you out). In that case you can use delayed message
153
153
  options:
154
154
 
155
155
  ```ruby
@@ -176,7 +176,12 @@ Pwwka.configure do |config|
176
176
  end
177
177
  ```
178
178
 
179
- Regardless of which processor you use, the name of the queue created is `pwwka_send_message_async`.
179
+ Regardless of which processor you use, the name of the queue created is `pwwka_send_message_async`. You will need to start a worker process to work the queue. For a `Procfile` setup, with Resque as the processor, that could look something like this:
180
+
181
+ ```ruby
182
+ pwwka_send_message_async_worker: rake resque:work QUEUE=pwwka_send_message_async
183
+ ```
184
+
180
185
 
181
186
  You can also configure Pwwka to use your own custom job using the `async_job_klass` configuration option. An example might be:
182
187
  ```
@@ -191,7 +196,7 @@ If you are using Resque and `Resque::Plugins::ExponentialBackoff` is available,
191
196
 
192
197
  #### Message Queuer
193
198
 
194
- You can queue up messages and send them in a batch. This is most useful when multiple messages
199
+ You can queue up messages and send them in a batch. This is most useful when multiple messages
195
200
  need to sent from within a transaction block.
196
201
 
197
202
  For example:
@@ -255,7 +260,7 @@ Here is an example:
255
260
 
256
261
  ```ruby
257
262
  class ClientIndexMessageHandler
258
-
263
+
259
264
  def self.handle!(delivery_info, properties, payload)
260
265
  handler.do_a_thing(payload)
261
266
  end
@@ -430,7 +435,7 @@ If you use [Resque][resque], and you wish to handle messages in a resque job, yo
430
435
 
431
436
  Note that you must provide `@queue` in your job. `QueueResqueJobHandler` doesn't support setting a custom queue at enqueue-time (PRs welcome :).
432
437
 
433
- Note that if you were using this library before version 0.12.0, your job would only be given the payload. If you change your job to accept exatly three arguments, you will be given the payload, routing key, and message properties. If any of those arguments are optional, you will need to set `PWWKA_QUEUE_EXTENDED_INFO` to `"true"` to force pwwka to pass those along. Without it, your job only gets the payload to avoid breaking legacy consumers.
438
+ Note that if you were using this library before version 0.12.0, your job would only be given the payload. If you change your job to accept exatly three arguments, you will be given the payload, routing key, and message properties. If any of those arguments are optional, you will need to set `PWWKA_QUEUE_EXTENDED_INFO` to `"true"` to force pwwka to pass those along. Without it, your job only gets the payload to avoid breaking legacy consumers.
434
439
 
435
440
  3. Profit!
436
441
 
@@ -454,9 +459,9 @@ describe "my integration test" do
454
459
  @test_handler.test_setup
455
460
  end
456
461
 
457
- after(:all) do
462
+ after(:all) do
458
463
  # this clears out any messages, so you have a clean test environment next time
459
- @test_handler.test_teardown
464
+ @test_handler.test_teardown
460
465
  end
461
466
 
462
467
  it "uses the message bus" do
@@ -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", error: e
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", error: e
34
+ logf "ERROR Opening RabbitMQ channel: #{e}", at: :error
31
35
  @connection.close if @connection
32
36
  raise e
33
37
  end
@@ -81,14 +85,14 @@ module Pwwka
81
85
  begin
82
86
  channel.close
83
87
  rescue => e
84
- logf "ERROR Closing RabbitMQ channel", error: e
88
+ logf "ERROR Closing RabbitMQ channel: #{e}", at: :error
85
89
  raise e
86
90
  end
87
91
 
88
92
  begin
89
93
  connection.close
90
94
  rescue => e
91
- logf "ERROR Closing connection to RabbitMQ", error: e
95
+ logf "ERROR Closing connection to RabbitMQ: #{e}", at: :error
92
96
  raise e
93
97
  end
94
98
  end
@@ -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
- Rails.application.class.parent.name
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"
@@ -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.3'
2
+ VERSION = '0.22.7'
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
  }
@@ -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(: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
 
@@ -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(:create_channel)
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(: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.3
4
+ version: 0.22.7
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-01-16 00:00:00.000000000 Z
18
+ date: 2020-06-12 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: '0'
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: '0'
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
@@ -317,8 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
317
319
  - !ruby/object:Gem::Version
318
320
  version: '0'
319
321
  requirements: []
320
- rubyforge_project:
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