2
2
3
3
require_relative 'supervisor_services_pb'
4
4
5
+ # Defines the gRPC server
5
6
class SupervisorServer < Supervisor ::Service
6
- # say_hello implements the SayHello rpc method.
7
+ # start_process implements the StartProcess rpc method.
7
8
def start_process ( start_process_req , _unused_call )
8
9
puts "Someone requested to start a process!!! #{ start_process_req } "
9
10
res = StartProcessResponse . new ( success : true )
10
11
puts "Responding with: #{ res } "
12
+ raise "ALE IS AN ASS"
11
13
res
12
14
end
13
15
end
14
16
15
- # Everything that is not an SIGINT (2), SIGTERM (15),
16
- # or a hard SIGKILL (9) (and a SIGSTOP(19) I guess...)
17
- # will trigger a process restart
18
- begin
19
- # Listen for commands over GRPC
20
- # Start and stop processes
21
- # Persist after each operation
22
- s = GRPC ::RpcServer . new
23
- s . add_http2_port ( '0.0.0.0:50051' , :this_port_is_insecure )
24
- s . handle ( SupervisorServer )
25
- s . run_till_terminated_or_interrupted ( [ 1 , 'int' , 'SIGQUIT' ] )
26
- rescue SignalException => e
27
- # Legit termination, exit
28
- rescue
29
- # everything else... restart
30
- end
17
+ # Runs the gRPC server
18
+ s = GRPC ::RpcServer . new
19
+ s . add_http2_port ( '0.0.0.0:50051' , :this_port_is_insecure )
20
+ s . handle ( SupervisorServer )
21
+ s . run_till_terminated_or_interrupted ( [ 1 , 'int' , 'SIGQUIT' ] )
0 commit comments