spinnaker-sidekiq 0.2.0 → 0.3.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: c4e8024010fdf4aa9297bf37e81fb0fcdc994bd33dd672006db938661257c100
4
- data.tar.gz: fff71ff97045ee109a1343cc34a6e37a6f5323a41eee647d7c9196c1f273d6d8
3
+ metadata.gz: 3315429bd29ee38d63ee6087f1d05e9492afed621ee5983ee45444c876763922
4
+ data.tar.gz: 64448a375557180ce8b2c42f5ceef57e2c1e7fd020babfdff2dfd3655e7cde11
5
5
  SHA512:
6
- metadata.gz: c9ab70e5a331ee439d997445a18f98d005aafd7e32b9de5e4296d36d858a3710460ad99f36e7d1234a4fe626d904a10502d94baa6533193910089000e9f3019a
7
- data.tar.gz: 1711aa7db2c88b286fa1e0c5b7dc18587e0c9f9d2fb96ccedc6b5f0df638c6e073b1dde170131e2bd6f1612e802c5a7217ba883d9943149c3f2e215640caffb7
6
+ metadata.gz: fb29e4d5adc141ffe5c115ea4c4f6ba78ceca6b57265d95276e18d6d5c108101e9d4350d19c241b2d5fcd86d892b94aab6aba766de43b75da134106a73e1e7f0
7
+ data.tar.gz: a6962a7b5075e30b23804f7e47f27af45c71fbca3c5ddf9d2140701b4a1faeb44e4fbb54e18678c6accfab7e01ee4bba5324ae95acd2636379cebcee44e58c72
data/Rakefile CHANGED
@@ -1,8 +1,4 @@
1
- begin
2
- require "bundler/setup"
3
- rescue LoadError
4
- puts "You must `gem install bundler` and `bundle install` to run rake tasks"
5
- end
1
+ require "bundler/setup"
6
2
 
7
3
  require "rdoc/task"
8
4
 
@@ -14,13 +10,12 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
10
  rdoc.rdoc_files.include("lib/**/*.rb")
15
11
  end
16
12
 
17
- APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
13
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
18
14
  load "rails/tasks/engine.rake"
19
15
 
20
16
  load "rails/tasks/statistics.rake"
21
17
 
22
18
  require "bundler/gem_tasks"
23
-
24
19
  require "rake/testtask"
25
20
 
26
21
  require "standard/rake"
@@ -26,11 +26,20 @@ module Spinnaker
26
26
 
27
27
  busy_jobs = processes.sum { |process| process["busy"] }
28
28
 
29
- status = busy_jobs == 0 ? "quiet" : "busy"
29
+ status = (busy_jobs == 0) ? "quiet" : "busy"
30
30
 
31
31
  render json: {status: status, progress: "Pending jobs: #{busy_jobs}"}
32
32
  end
33
33
 
34
+ def terminate_all
35
+ ps = ::Sidekiq::ProcessSet.new
36
+ ps.each(&:quiet!)
37
+ ::Sidekiq.redis { |conn|
38
+ conn.publish("sidekiq:terminate", Time.now.to_i)
39
+ }
40
+ render plain: "Terminate signal sent to Sidekiq workers"
41
+ end
42
+
34
43
  private
35
44
 
36
45
  def authenticate
data/config/routes.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  Spinnaker::Sidekiq::Engine.routes.draw do
2
2
  post "/quiet_all", to: "api#quiet_all"
3
3
  get "/status", to: "api#status"
4
+
5
+ post "/terminate_all", to: "api#terminate_all"
4
6
  end
@@ -1,5 +1,5 @@
1
1
  module Spinnaker
2
2
  module Sidekiq
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -1,3 +1,4 @@
1
+ require "spinnaker/sidekiq/version"
1
2
  require "spinnaker/sidekiq/engine"
2
3
 
3
4
  module Spinnaker
@@ -9,11 +10,19 @@ module Spinnaker
9
10
  end
10
11
 
11
12
  class << self
12
- attr_writer :api_token
13
+ attr_writer :api_token, :shutdown_signal_ttl, :terminate_callback
13
14
 
14
15
  def api_token
15
16
  @api_token ||= ENV.fetch("SPINNAKER_SIDEKIQ_API_TOKEN") { raise MissingApiToken }
16
17
  end
18
+
19
+ def shutdown_signal_ttl
20
+ @shutdown_signal_ttl ||= ENV.fetch("SPINNAKER_SIDEKIQ_SHUTDOWN_SIGNAL_TTL", 30).to_i
21
+ end
22
+
23
+ def terminate_callback
24
+ @terminate_callback || raise("terminate_callback not set")
25
+ end
17
26
  end
18
27
  end
19
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spinnaker-sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Dias
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-29 00:00:00.000000000 Z
11
+ date: 2024-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -116,7 +116,7 @@ homepage: https://github.com/intellum/spinnaker-sidekiq
116
116
  licenses:
117
117
  - MIT
118
118
  metadata: {}
119
- post_install_message:
119
+ post_install_message:
120
120
  rdoc_options: []
121
121
  require_paths:
122
122
  - lib
@@ -131,9 +131,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  requirements: []
134
- rubyforge_project:
135
- rubygems_version: 2.7.6.2
136
- signing_key:
134
+ rubygems_version: 3.2.33
135
+ signing_key:
137
136
  specification_version: 4
138
137
  summary: Spinnaker Sidekiq integration
139
138
  test_files: []