Added code to stop gql server on shutdown

gql_cataclysm
noah metz 2023-10-08 23:53:38 -06:00
parent 6381713972
commit 542c5c18af
1 changed files with 8 additions and 2 deletions

@ -1328,12 +1328,18 @@ func (ext *GQLExt) Process(ctx *Context, node *Node, source NodeID, signal Signa
ctx.Log.Logf("gql", "Received read result that wasn't expected - %+v", sig) ctx.Log.Logf("gql", "Received read result that wasn't expected - %+v", sig)
} }
case *StopSignal:
ctx.Log.Logf("gql", "stopping gql server %s", node.ID)
err := ext.StopGQLServer()
if err != nil {
ctx.Log.Logf("gql", "GQL_STOP_ERROR: %s", err)
}
case *StartSignal: case *StartSignal:
ctx.Log.Logf("gql", "starting gql server %s", node.ID) ctx.Log.Logf("gql", "starting gql server %s", node.ID)
err := ext.StartGQLServer(ctx, node) err := ext.StartGQLServer(ctx, node)
changes = changes.Add("server_started")
if err == nil { if err == nil {
node.QueueSignal(time.Now(), NewStatusSignal(node.ID, "server_started")) changes = changes.Add("server_started")
} else { } else {
ctx.Log.Logf("gql", "GQL_RESTART_ERROR: %s", err) ctx.Log.Logf("gql", "GQL_RESTART_ERROR: %s", err)
} }