Skip to content

Conversation

@qcn
Copy link

@qcn qcn commented Aug 9, 2021

We used this gem for monitoring and found that it was useful to expose the aliveness status of the client to check if we needed to restart it.

@eli-darkly
Copy link
Contributor

I don't quite understand the rationale for this, because the attribute you're checking, @stopped, only gets set to true if you have explicitly called close to shut down the client permanently. So 1. there's no way the client could have stopped itself without you already knowing about it, and 2. there is no restarting from that state.

@qcn
Copy link
Author

qcn commented Aug 10, 2021

The use-case is that we check this in a loop - if there's an error, we call close to shut down the client, but that's a response to an event. In the loop, if the client has been shut down, we spin up a new one. We could do this by setting a flag in our error handler and looping on that instead, but by exposing the stopped state of the client we link that behaviour explicitly to the client rather than an external flag.

@eli-darkly
Copy link
Contributor

@qcn I see. I have no problem with adding this method, but I think it's a bit confusing to call it is_alive? when "alive" isn't a word that's used anywhere else in the API. Could you change it to is_closed? (and have it return the value of @stopped rather than the opposite) to clarify that it's referring to the state caused by close?

@eli-darkly
Copy link
Contributor

Actually how about just closed? - Ruby's naming conventions don't require "is" for boolean getters.

@qcn
Copy link
Author

qcn commented Aug 11, 2021

@eli-darkly Great! I've made the change requested, thank you for the discussion! :)

@eli-darkly eli-darkly merged commit d8513fe into launchdarkly:master Aug 11, 2021
@eli-darkly
Copy link
Contributor

Version 2.1.0 has been released with this change.

@qcn
Copy link
Author

qcn commented Aug 12, 2021

@eli-darkly Thank you so much!

@qcn qcn deleted the add_liveness_check branch August 12, 2021 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants