process_bot 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/process_bot/control_socket.rb +26 -12
- data/lib/process_bot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7faeef8de7bcedd0fb66cc0fcf161de87d94ee3d4e9cceda30086afc12fc09fb
|
|
4
|
+
data.tar.gz: 79370a6f54b1f58ee5df361bdf99637e206310d126bbd9da2a8bbeae509561bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 01ab0ae7b02f813fd00313750924b3162167506cc546b49c6d03dc38fd702b3a5d1082aa45cdc7267800575acdb517381b5243937214319b630ee99d765ee6a2
|
|
7
|
+
data.tar.gz: 0df83d2af7a0180834e6bfb50d3fcd6e9834abb3a60d23a78cd5d80bc5a6c8441ad0f242da3cccb4b8eb4e49fa9ce12d041b87bd69be7d1e729e151f349d1937
|
data/Gemfile.lock
CHANGED
|
@@ -43,10 +43,16 @@ class ProcessBot::ControlSocket
|
|
|
43
43
|
|
|
44
44
|
def run_client_loop
|
|
45
45
|
Thread.new do
|
|
46
|
-
|
|
46
|
+
loop do
|
|
47
|
+
begin
|
|
48
|
+
client = server.accept
|
|
49
|
+
rescue IOError, Errno::EBADF
|
|
50
|
+
break
|
|
51
|
+
end
|
|
47
52
|
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
Thread.new do
|
|
54
|
+
handle_client(client)
|
|
55
|
+
end
|
|
50
56
|
end
|
|
51
57
|
end
|
|
52
58
|
end
|
|
@@ -67,15 +73,7 @@ class ProcessBot::ControlSocket
|
|
|
67
73
|
{}
|
|
68
74
|
end
|
|
69
75
|
|
|
70
|
-
|
|
71
|
-
command_type = "graceful"
|
|
72
|
-
command_options[:wait_for_gracefully_stopped] = false
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
logger.logs "Command #{command_type} with options #{command_options}"
|
|
76
|
-
|
|
77
|
-
process.__send__(command_type, **command_options)
|
|
78
|
-
client.puts(JSON.generate(type: "success"))
|
|
76
|
+
run_command(command_type, command_options, client)
|
|
79
77
|
rescue => e # rubocop:disable Style/RescueStandardError
|
|
80
78
|
logger.error e.message
|
|
81
79
|
logger.error e.backtrace
|
|
@@ -100,4 +98,20 @@ class ProcessBot::ControlSocket
|
|
|
100
98
|
|
|
101
99
|
new_hash
|
|
102
100
|
end
|
|
101
|
+
|
|
102
|
+
def run_command(command_type, command_options, client)
|
|
103
|
+
command_type, command_options = normalize_command(command_type, command_options)
|
|
104
|
+
logger.logs "Command #{command_type} with options #{command_options}"
|
|
105
|
+
|
|
106
|
+
process.__send__(command_type, **command_options)
|
|
107
|
+
client.puts(JSON.generate(type: "success"))
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def normalize_command(command_type, command_options)
|
|
111
|
+
return [command_type, command_options] unless command_type == "graceful_no_wait"
|
|
112
|
+
|
|
113
|
+
command_type = "graceful"
|
|
114
|
+
command_options[:wait_for_gracefully_stopped] = false
|
|
115
|
+
[command_type, command_options]
|
|
116
|
+
end
|
|
103
117
|
end
|
data/lib/process_bot/version.rb
CHANGED