Closed scottrobertson closed 4 years ago
Don't send any state value unless it's quiet or terminate. Any other value is ignored.
Yes, by design processes are only removed once their heartbeat times out. They never explicitly remove themselves, otherwise you might get a process that is removed but still running.
You need to use a global variable to track the current state: "", "quiet" or "terminate". Don't explicitly call beat() once with the state change but rather allow the heartbeat to send the current state with every beat. The line you want to modify is in launcher.rb.
@mperham that makes sense. What class would you keep that current_state in?
I would put it all in launcher. You don’t even need a global if launcher tracks the current state internally.
On Jan 11, 2020, at 09:39, Scott Robertson notifications@github.com wrote:
@mperham that makes sense. What class would you keep that current_state in?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
@mperham pushed. That seem ok? Basically removed the @done
in Launcher in favour of having a @current_state
I tested it manually yeah :) most of the time it will not actually send a "quiet", as it gets to "terminate" too quickly, but yeah, it works.
if terminate is sent, it still seems to show quiet in the UI.
yeah, the only label the UI shows is quiet. A terminating process is, by definition, quiet also.
1 question for you @mperham around this.
Is sending
nil
as thecurrent_state
ok, or should I add a conditional to only send that when there is no state. Seems like a waste of bytes otherwise, but will let you answer before I add more complexity.One thing i have noticed is that it still takes a little while for the UI to remove the worker, even after sending the
current_state = terminate
. Is this by design?