govuk_sidekiq 3.0.0 → 3.0.1

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
- SHA1:
3
- metadata.gz: 1be19282faabbf2677cfc7ef513a07b7eba4cf58
4
- data.tar.gz: 95c1fe848d469231ec76263a56a6094dd85d7c6c
2
+ SHA256:
3
+ metadata.gz: 28d8418678a9c9f5e0ba826e3f97ca55f43d3a2aa03ecd8c66cb9818d08fcc5b
4
+ data.tar.gz: c772e3e16a565db487022ec79069dfa25831208a97b415d42d7a0ce36ef7750e
5
5
  SHA512:
6
- metadata.gz: 5dae35a20d6f158cff09780b6b1d3bea5bef9ca8e24c2588e05136dda98249650224270ca6b3ed1f93827038e48f7f6b10c4fa61c6badc7cb0ce4f795548392f
7
- data.tar.gz: 9a13810fcecd5bb5068f357f043507379f106e2808f8e6f61adb2437fcf4166e966b91e17229e6ef3baaa07e4ae637cb1e1361297c8ecc5ad0b1b6676e5499a5
6
+ metadata.gz: 21c143a20db81e030109de63523be78122f069e5a9e597735204011f6bf371de60194d77bb24c32988c497afd034425b8d0e787463ad276418a83f0078b0c264
7
+ data.tar.gz: 901c00abb0de2d7260566604c2581df3913acf44fe29cc027221bcb3091fd59994c4176c3b0dd486d6bad505fc47c3cffdd88c56dce674f13845ad4efefccfb1
File without changes
@@ -8,7 +8,12 @@ module GovukSidekiq
8
8
  # https://github.com/mperham/sidekiq/wiki/Middleware#client-side-middleware
9
9
  class ClientMiddleware
10
10
  def call(worker_class, job, queue, redis_pool)
11
- job["args"] << header_arguments
11
+ last_arg = job["args"].last
12
+
13
+ if needs_headers(last_arg)
14
+ job["args"] << header_arguments
15
+ end
16
+
12
17
  yield
13
18
  end
14
19
 
@@ -18,6 +23,11 @@ module GovukSidekiq
18
23
  request_id: GdsApi::GovukHeaders.headers[:govuk_request_id],
19
24
  }
20
25
  end
26
+
27
+ def needs_headers(last_arg)
28
+ has_args = last_arg.is_a?(Hash) && last_arg.symbolize_keys.keys.include?(:authenticated_user) && last_arg.symbolize_keys.keys.include?(:request_id)
29
+ !has_args && header_arguments[:authenticated_user].present? && header_arguments[:request_id].present?
30
+ end
21
31
  end
22
32
 
23
33
  # Server-side middleware runs 'around' job processing.
@@ -1,3 +1,3 @@
1
1
  module GovukSidekiq
2
- VERSION = "3.0.0"
2
+ VERSION = "3.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - Elliot Crosby-McCullough
7
+ - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-08 00:00:00.000000000 Z
11
+ date: 2018-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -158,12 +158,12 @@ dependencies:
158
158
  version: '1.10'
159
159
  description:
160
160
  email:
161
- - elliot.cm@gmail.com
161
+ - govuk-dev@digital.cabinet-office.gov.uk
162
162
  executables: []
163
163
  extensions: []
164
164
  extra_rdoc_files: []
165
165
  files:
166
- - LICENCE.txt
166
+ - LICENCE
167
167
  - README.md
168
168
  - lib/govuk_sidekiq.rb
169
169
  - lib/govuk_sidekiq/api_headers.rb
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  version: '0'
192
192
  requirements: []
193
193
  rubyforge_project:
194
- rubygems_version: 2.6.13
194
+ rubygems_version: 2.7.6
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: Provides standard setup and behaviour for Sidekiq in GOV.UK applications.