govuk_sidekiq 8.0.1 → 9.0.0

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: d7b4ab2c71b0c6f3a467cfe76ec1e7308326d944c6567ecfbeecc7b602e42b65
4
- data.tar.gz: 212e668881f3a9c0f312e6b12ae5fd635cfd6a9e25e2d0f64a974ca99e06b5a3
3
+ metadata.gz: b170a15b6b0a3a7f44bebbc052720d696908ae99f9e535d633efb9ad9dd7c54f
4
+ data.tar.gz: 0bb96f89538aa771b546e05b64a15293e12bcf21e191dfc2ea029d78de36b442
5
5
  SHA512:
6
- metadata.gz: 2e9f0e736b6e4ec68943af328749c6db2c105a25d1cdc64b0c1282ecdbbd3813f91b5fe8ee685a568aa32cf9364c674a56b480c0c815f5d678f62207682290df
7
- data.tar.gz: ee5fa55517ffe8d6f9059479878dcfab062a819f12023c4f495d630966abbc36b2358cf03140973924ed163c43be4830c5395e9f925b98a1230a7fd135033af5
6
+ metadata.gz: bc859c90d6cd45da1111177dfd7eb6ad4bec5a03f9f3f148567d71e24721f7ce9c5c98f8ab2f327e7ac76fb0986d4eb14f02669a4fed6d524e1344d39c56c6e8
7
+ data.tar.gz: b5e06dffc8cc92fde8a4a286f9caf1db2d770973e3755160d057862f1b5046167a7f6ca6492fbe436ab8de041004e588d603e993ca064ee338db7ff2c648d1ed
@@ -2,11 +2,15 @@ require "govuk_sidekiq/sidekiq_initializer"
2
2
 
3
3
  module GovukSidekiq
4
4
  class Railtie < Rails::Railtie
5
- initializer "govuk_sidekiq.initialize_sidekiq" do |app|
5
+ initializer "govuk_sidekiq.initialize_sidekiq" do
6
6
  SidekiqInitializer.setup_sidekiq(
7
- ENV.fetch("GOVUK_APP_NAME", app.root.basename.to_s),
8
7
  { url: ENV.fetch("REDIS_URL", "redis://127.0.0.1:6379") },
9
8
  )
10
9
  end
10
+
11
+ rake_tasks do
12
+ path = File.expand_path(__dir__)
13
+ Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
14
+ end
11
15
  end
12
16
  end
@@ -4,13 +4,8 @@ require "govuk_sidekiq/govuk_json_formatter"
4
4
 
5
5
  module GovukSidekiq
6
6
  module SidekiqInitializer
7
- def self.setup_sidekiq(govuk_app_name, redis_config = {})
8
- redis_config = redis_config.merge(
9
- namespace: govuk_app_name,
10
- reconnect_attempts: 4,
11
- reconnect_delay: 15,
12
- reconnect_delay_max: 60,
13
- )
7
+ def self.setup_sidekiq(redis_config = {})
8
+ redis_config = redis_config.merge(reconnect_attempts: [15, 30, 45, 60])
14
9
 
15
10
  Sidekiq.configure_server do |config|
16
11
  # $real_stdout is defined by govuk_app_config and is used to point to
@@ -21,7 +16,7 @@ module GovukSidekiq
21
16
  # rubocop:disable Style/GlobalVars
22
17
  config.logger = Sidekiq::Logger.new($real_stdout) if defined?($real_stdout)
23
18
  # rubocop:enable Style/GlobalVars
24
- config.log_formatter = GovukSidekiq::GovukJsonFormatter.new if ENV["GOVUK_SIDEKIQ_JSON_LOGGING"]
19
+ config.logger.formatter = GovukSidekiq::GovukJsonFormatter.new if ENV["GOVUK_SIDEKIQ_JSON_LOGGING"]
25
20
 
26
21
  config.redis = redis_config
27
22
 
@@ -0,0 +1,15 @@
1
+ namespace :redis_namespace do
2
+ desc "Remove application specific namespacing for all Redis keys"
3
+ task :remove_namespace, :environment do
4
+ namespace = ENV["GOVUK_APP_NAME"]
5
+
6
+ redis = RedisClient.new(url: ENV["REDIS_URL"])
7
+
8
+ namespaced_keys = redis.call("KEYS", "#{namespace}:*")
9
+
10
+ namespaced_keys.each do |key|
11
+ new_key = key.gsub(/^#{namespace}:/, "")
12
+ redis.call("RENAME", key, new_key)
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module GovukSidekiq
2
- VERSION = "8.0.1".freeze
2
+ VERSION = "9.0.0".freeze
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: 8.0.1
4
+ version: 9.0.0
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: 2024-06-11 00:00:00.000000000 Z
11
+ date: 2024-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gds-api-adapters
@@ -39,53 +39,39 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.1'
41
41
  - !ruby/object:Gem::Dependency
42
- name: redis
42
+ name: redis-client
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "<"
46
- - !ruby/object:Gem::Version
47
- version: '5'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "<"
53
- - !ruby/object:Gem::Version
54
- version: '5'
55
- - !ruby/object:Gem::Dependency
56
- name: redis-namespace
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
45
+ - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: '1.6'
47
+ version: 0.22.2
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - "~>"
52
+ - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: '1.6'
54
+ version: 0.22.2
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: sidekiq
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: '6.5'
76
- - - ">="
61
+ version: '7.0'
62
+ - - "<"
77
63
  - !ruby/object:Gem::Version
78
- version: 6.5.12
64
+ version: '8'
79
65
  type: :runtime
80
66
  prerelease: false
81
67
  version_requirements: !ruby/object:Gem::Requirement
82
68
  requirements:
83
69
  - - "~>"
84
70
  - !ruby/object:Gem::Version
85
- version: '6.5'
86
- - - ">="
71
+ version: '7.0'
72
+ - - "<"
87
73
  - !ruby/object:Gem::Version
88
- version: 6.5.12
74
+ version: '8'
89
75
  - !ruby/object:Gem::Dependency
90
76
  name: climate_control
91
77
  requirement: !ruby/object:Gem::Requirement
@@ -148,14 +134,14 @@ dependencies:
148
134
  requirements:
149
135
  - - '='
150
136
  - !ruby/object:Gem::Version
151
- version: 4.18.0
137
+ version: 5.0.2
152
138
  type: :development
153
139
  prerelease: false
154
140
  version_requirements: !ruby/object:Gem::Requirement
155
141
  requirements:
156
142
  - - '='
157
143
  - !ruby/object:Gem::Version
158
- version: 4.18.0
144
+ version: 5.0.2
159
145
  description:
160
146
  email:
161
147
  - govuk-dev@digital.cabinet-office.gov.uk
@@ -170,6 +156,7 @@ files:
170
156
  - lib/govuk_sidekiq/govuk_json_formatter.rb
171
157
  - lib/govuk_sidekiq/railtie.rb
172
158
  - lib/govuk_sidekiq/sidekiq_initializer.rb
159
+ - lib/govuk_sidekiq/tasks/redis_namespace.rake
173
160
  - lib/govuk_sidekiq/testing.rb
174
161
  - lib/govuk_sidekiq/version.rb
175
162
  homepage: http://github.com/alphagov/govuk_sidekiq
@@ -191,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
178
  - !ruby/object:Gem::Version
192
179
  version: '0'
193
180
  requirements: []
194
- rubygems_version: 3.5.11
181
+ rubygems_version: 3.5.19
195
182
  signing_key:
196
183
  specification_version: 4
197
184
  summary: Provides standard setup and behaviour for Sidekiq in GOV.UK applications.