-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added feature to Force kill instance (#15)
* Start force kill * Force kill an instance * Check if process exists * Added changelog * Fix tests * Fix rubocop warnings
- Loading branch information
Showing
7 changed files
with
78 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
## [Unreleased] | ||
## [0.3.6] - 2024-09-27 | ||
|
||
- Added force kill to instances | ||
|
||
## [0.3.5] - 2024-09-27 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
sidekiq-belt (0.3.5) | ||
sidekiq-belt (0.3.6) | ||
sidekiq (> 7.1.4) | ||
|
||
GEM | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# frozen_string_literal: true | ||
|
||
require "sidekiq/web" | ||
require "sidekiq/web/helpers" | ||
require "byebug" | ||
|
||
module Sidekiq | ||
module Belt | ||
module Community | ||
module ForceKill | ||
def kill! | ||
signal("KILL") | ||
end | ||
|
||
module SidekiqForceKill | ||
def self.registered(app) | ||
app.replace_content("/busy") do |content| | ||
content.gsub!("<%= t('Stop') %></button>") do | ||
"<%= t('Stop') %></button>" \ | ||
"<% if process.stopping? %>" \ | ||
"<a href=\"<%= root_path %>/force_kill/<%= process['identity'] %>/kill\" " \ | ||
"class=\"btn btn-xs btn-danger\" data-confirm=\"<%= t('AreYouSure') %>\">" \ | ||
"<%= t('Kill') %></a>" \ | ||
"<% end %>" | ||
end | ||
end | ||
|
||
app.get("/force_kill/:identity/kill") do | ||
process = Sidekiq::ProcessSet[params["identity"]] | ||
|
||
if process | ||
process.stop! | ||
process.kill! | ||
end | ||
|
||
return redirect "#{root_path}busy" | ||
end | ||
end | ||
end | ||
|
||
def self.use! | ||
Sidekiq::Web.register(Sidekiq::Belt::Community::ForceKill::SidekiqForceKill) | ||
Sidekiq::Process.prepend(Sidekiq::Belt::Community::ForceKill) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
module Sidekiq | ||
module Belt | ||
VERSION = "0.3.5" | ||
VERSION = "0.3.6" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters