Skip to content

Commit

Permalink
chore: add debug logs to server liveness monitor (#5693)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasiaMarek authored Oct 2, 2023
1 parent 8f590ee commit d98f1c0
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class ServerLivenessMonitor(
ServerLivenessMonitor.noResponseParams(serverName, icons)

client.metalsStatus(connectedParams)
scribe.debug("starting server liveness monitor")

def runnable(): Runnable = new Runnable {
def run(): Unit = {
Expand All @@ -90,15 +91,26 @@ class ServerLivenessMonitor(
case ServerLivenessMonitor.Idle => ServerLivenessMonitor.FirstPing
case _ => ServerLivenessMonitor.Running
}
currState match {
case ServerLivenessMonitor.Idle =>
scribe.debug("setting server liveness monitor state to FirstPing")
case ServerLivenessMonitor.FirstPing =>
scribe.debug("setting server liveness monitor state to Running")
case _ =>
}
if (currState == ServerLivenessMonitor.Running) {
if (notResponding && isServerResponsive)
if (notResponding && isServerResponsive) {
scribe.debug("server liveness monitor detected no response")
client.metalsStatus(noResponseParams)
else if (!notResponding && !isServerResponsive)
} else if (!notResponding && !isServerResponsive)
client.metalsStatus(connectedParams)
isServerResponsive = !notResponding
}
scribe.debug("server liveness monitor: pinging build server...")
ping()
} else {
if (state.get() != ServerLivenessMonitor.Idle)
scribe.debug("setting server liveness monitor state to Idle")
state.set(ServerLivenessMonitor.Idle)
}
}
Expand All @@ -113,6 +125,7 @@ class ServerLivenessMonitor(
def isBuildServerResponsive: Boolean = isServerResponsive

def shutdown(): Unit = {
scribe.debug("shutting down server liveness monitor")
scheduled.cancel(true)
scheduler.shutdown()
client.metalsStatus(ServerLivenessMonitor.disconnectedParams)
Expand Down

0 comments on commit d98f1c0

Please sign in to comment.