Skip to content

Commit

Permalink
Add terminating state
Browse files Browse the repository at this point in the history
Signed-off-by: David Piegza <[email protected]>
  • Loading branch information
davidpiegza committed Aug 9, 2023
1 parent 9f9b77f commit a080a63
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions go/vt/vtgate/vtgate.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ var (
// healthCheckTimeout is the timeout on the RPC call to tablets
healthCheckTimeout = time.Minute

terminating bool

// System settings related flags
sysVarSetEnabled = true
setVarEnabled = true
Expand Down Expand Up @@ -328,6 +330,8 @@ func Init(
}
})
servenv.OnTerm(func() {
terminating = true

if st != nil && enableSchemaChangeSignal {
st.Stop()
}
Expand Down Expand Up @@ -405,6 +409,10 @@ func (vtg *VTGate) registerDebugHealthHandler() {
// IsHealthy returns nil if server is healthy.
// Otherwise, it returns an error indicating the reason.
func (vtg *VTGate) IsHealthy() error {
if terminating {
return errors.New("Terminating")
}

return nil
}

Expand Down

0 comments on commit a080a63

Please sign in to comment.