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 +5 -5
- data/{LICENCE.txt → LICENCE} +0 -0
- data/lib/govuk_sidekiq/api_headers.rb +11 -1
- data/lib/govuk_sidekiq/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 28d8418678a9c9f5e0ba826e3f97ca55f43d3a2aa03ecd8c66cb9818d08fcc5b
|
4
|
+
data.tar.gz: c772e3e16a565db487022ec79069dfa25831208a97b415d42d7a0ce36ef7750e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21c143a20db81e030109de63523be78122f069e5a9e597735204011f6bf371de60194d77bb24c32988c497afd034425b8d0e787463ad276418a83f0078b0c264
|
7
|
+
data.tar.gz: 901c00abb0de2d7260566604c2581df3913acf44fe29cc027221bcb3091fd59994c4176c3b0dd486d6bad505fc47c3cffdd88c56dce674f13845ad4efefccfb1
|
data/{LICENCE.txt → LICENCE}
RENAMED
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"]
|
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.
|
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.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
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
|
-
-
|
161
|
+
- govuk-dev@digital.cabinet-office.gov.uk
|
162
162
|
executables: []
|
163
163
|
extensions: []
|
164
164
|
extra_rdoc_files: []
|
165
165
|
files:
|
166
|
-
- LICENCE
|
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
|
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.
|