is it just me or is (what's currently) `nailgun::S...
# development
h
is it just me or is (what's currently)
nailgun::ServerState
not being used by anything? @witty-crayon-22786
w
looks like it, yea. the unnecessary
pub
is throwing off dead code detection
h
ok I'll remove it
also re: https://github.com/pantsbuild/pants/pull/10865#discussion_r498970890 , how much of the
let exit_code =...
block do you think is simplifiable? most of the logic there is taking care of making sure the
python_signal_fn
callback is repeatedly invoked so we can handle a ctrl-C
@witty-crayon-22786
w
Mm mm. Got it.
I think that that could be a select loop without a spawned task though?
select(am_i_dead, exit_code)
But maybe you'd need a spawned task to check the "am_i_dead" flag in a loop
So perhaps not a lot simpler
h
I think the fundamental thing that needs to happen here is that
maybe_break_execution_loop
needs to get called in a synchronous loop, once every <100ms
I don't know how to make that interact with an async task other than with
executor.spawn
w
Yea. Or the signal handler would need to set the signal by putting it directly on a future queue/tokio event thing.
Yea, that's right. As long as the boolean is itself not an async eventy thing (see above)
h
is there a way to have python function do that across the FFI?
w
Yea... Call an ffi that does it
... but it would need to interact with a Session or a global somehow I suppose
...a global in this case maybe, because this is the client, so there is no Session, just an Executor. But on the server this will eventually be something like
Session.canceled
h
right, but that's out of scope for this PR, right?
I mean, figuring out the design for what state will exist on a
Session
to indicate that the client has requested cancellation
w
Probably/maybe. Having the state is different from how it is set (signals vs heartbeats)
You already have the state in one place
h
in any case, that doesn't sound much simpler than calling
spawn
+ this loop, unless there's a reason to want to avoid calling
spawn
w
Yea, fine