sidekiq-belt 0.3.4 → 0.3.6

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: fb4d769018b00b231892ae9852e6fd7d8c51074f6752332fa46ce6e606d68ba7
4
- data.tar.gz: 9b05f6c1a3a505c7e6028bd6248f07ed7964a307129d7f8fc3206d96817c2b61
3
+ metadata.gz: 0620ca72d8c203a723b37c5b557e3cb7ddb836572b3e55c13f915b08ade54690
4
+ data.tar.gz: 43554ce2b06473406080e4973614e93828ec814a6d4ed410e6fabd97e7d94971
5
5
  SHA512:
6
- metadata.gz: d7c1f6c6ef57da7f982bc3c1c2cfc8ffec1982ed0030a37f9b829fc9ff4e2dcabd1f606283d81014e668fa1063504f6b2dcf77837b45939a3654f91d5f99354b
7
- data.tar.gz: 6cb88155712149c79268f4f0a27a49c81e60eccc890c6eed0a1a9c29b9697ff561d9730f333c16b428bbf3ca0b50a2857da1439e7b049f367b8511b3b269af3a
6
+ metadata.gz: 8de6db5e1e246a279e586378afbaf72aba5527b501642bb3e09e1b75413d2ac8b2f3242058f27155728e6627891f0e166e296ab735e6c895fba6428a4a524397
7
+ data.tar.gz: 14d4d139eef62eec7270794bcdeb73f19ea24a64980878b06b09ba2366dc9b8ad1bba77796da046962dfb648c5cfb8bdb1ac063b72d9bf6fa7c1c1497d7aeb2f
data/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
1
  ## [Unreleased]
2
+ ## [0.3.6] - 2024-09-27
3
+
4
+ - Added force kill to instances
5
+
6
+ ## [0.3.5] - 2024-09-27
7
+
8
+ - Fix replace_content to dynamic routes
2
9
 
3
10
  ## [0.3.4] - 2024-01-07
4
11
 
@@ -4,6 +4,7 @@ require "sidekiq"
4
4
 
5
5
  require_relative "run_job"
6
6
  require_relative "top_label"
7
+ require_relative "force_kill"
7
8
 
8
9
  module Sidekiq
9
10
  module Belt
@@ -12,6 +13,7 @@ module Sidekiq
12
13
  def self.use!(options = [:all])
13
14
  Sidekiq::Belt::Community::RunJob.use! if should_use?(:run_job, options)
14
15
  Sidekiq::Belt::Community::TopLabel.use! if should_use?(:top_label, options)
16
+ Sidekiq::Belt::Community::ForceKill.use! if should_use?(:force_kill, options)
15
17
 
16
18
  true
17
19
  end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "sidekiq/web"
4
+ require "sidekiq/web/helpers"
5
+ require "byebug"
6
+
7
+ module Sidekiq
8
+ module Belt
9
+ module Community
10
+ module ForceKill
11
+ def kill!
12
+ signal("KILL")
13
+ end
14
+
15
+ module SidekiqForceKill
16
+ def self.registered(app)
17
+ app.replace_content("/busy") do |content|
18
+ content.gsub!("<%= t('Stop') %></button>") do
19
+ "<%= t('Stop') %></button>" \
20
+ "<% if process.stopping? %>" \
21
+ "<a href=\"<%= root_path %>/force_kill/<%= process['identity'] %>/kill\" " \
22
+ "class=\"btn btn-xs btn-danger\" data-confirm=\"<%= t('AreYouSure') %>\">" \
23
+ "<%= t('Kill') %></a>" \
24
+ "<% end %>"
25
+ end
26
+ end
27
+
28
+ app.get("/force_kill/:identity/kill") do
29
+ process = Sidekiq::ProcessSet[params["identity"]]
30
+
31
+ if process
32
+ process.stop!
33
+ process.kill!
34
+ end
35
+
36
+ return redirect "#{root_path}busy"
37
+ end
38
+ end
39
+ end
40
+
41
+ def self.use!
42
+ Sidekiq::Web.register(Sidekiq::Belt::Community::ForceKill::SidekiqForceKill)
43
+ Sidekiq::Process.prepend(Sidekiq::Belt::Community::ForceKill)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sidekiq
4
4
  module Belt
5
- VERSION = "0.3.4"
5
+ VERSION = "0.3.6"
6
6
  end
7
7
  end
@@ -5,22 +5,30 @@ require "sidekiq/web/action"
5
5
 
6
6
  module Sidekiq
7
7
  module WebActionHelper
8
- def render(engine, content, options = {})
9
- begin
10
- path_info = /"([^"]*)"/.match(block.source.to_s)[1]
11
- rescue StandardError
12
- path_info = nil
13
- end
8
+ class ERB < ::ERB
9
+ def initialize(content)
10
+ replace_views = Sidekiq::Config::DEFAULTS[:replace_views] || {}
14
11
 
15
- path_info ||= ::Rack::Utils.unescape(env["PATH_INFO"])
12
+ replace_views.each do |key, content_blocks|
13
+ next if WebRoute.new("", key, true).match("", self.class.path_info).nil?
16
14
 
17
- replace_views = Sidekiq::Config::DEFAULTS[:replace_views] || {}
15
+ content_blocks.each do |content_block|
16
+ content_block.call(content)
17
+ end
18
+ end
18
19
 
19
- replace_views.fetch(path_info.to_s, []).each do |content_block|
20
- content_block.call(content)
20
+ super
21
+ end
22
+
23
+ class << self
24
+ attr_accessor :path_info
21
25
  end
26
+ end
27
+
28
+ def erb(content, options = {})
29
+ ERB.path_info = ::Rack::Utils.unescape(env["PATH_INFO"])
22
30
 
23
- super(engine, content, options)
31
+ super
24
32
  end
25
33
 
26
34
  def self.change_layout(&block)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-belt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danilo Jeremias da Silva
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-16 00:00:00.000000000 Z
11
+ date: 2024-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -42,6 +42,7 @@ files:
42
42
  - lib/sidekiq-belt.rb
43
43
  - lib/sidekiq/belt.rb
44
44
  - lib/sidekiq/belt/community/files.rb
45
+ - lib/sidekiq/belt/community/force_kill.rb
45
46
  - lib/sidekiq/belt/community/run_job.rb
46
47
  - lib/sidekiq/belt/community/top_label.rb
47
48
  - lib/sidekiq/belt/community/views/run_jobs.erb
@@ -62,7 +63,7 @@ metadata:
62
63
  homepage_uri: https://github.com/dannnylo/sidekiq-belt
63
64
  source_code_uri: https://github.com/dannnylo/sidekiq-belt
64
65
  rubygems_mfa_required: 'true'
65
- post_install_message:
66
+ post_install_message:
66
67
  rdoc_options: []
67
68
  require_paths:
68
69
  - lib
@@ -77,8 +78,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
78
  - !ruby/object:Gem::Version
78
79
  version: '0'
79
80
  requirements: []
80
- rubygems_version: 3.5.3
81
- signing_key:
81
+ rubygems_version: 3.5.16
82
+ signing_key:
82
83
  specification_version: 4
83
84
  summary: This Ruby gem enhances the capabilities of Sidekiq, Sidekiq Pro, and Sidekiq
84
85
  Enterprise by adding essential utilities.