Skip to content

Commit

Permalink
GraceTermination when GameServer get deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
qizichao-dm committed May 8, 2023
1 parent 8b56232 commit b1b48e1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/sdkserver/sdkserver.go
Expand Up @@ -342,6 +342,16 @@ func (s *SDKServer) updateState(ctx context.Context) error {
// If we are currently in shutdown/being deleted, there is no escaping.
if gs.IsBeingDeleted() {
s.logger.Debug("GameServerState being shutdown. Skipping update.")

// Explicitly update gsStateChannel if current state is Shutdown since sendGameServerUpdate will not triggered.
if runtime.FeatureEnabled(runtime.FeatureSDKGracefulTermination) {
if s.gsState == agonesv1.GameServerStateShutdown && gs.Status.State != agonesv1.GameServerStateShutdown {
go func() {
s.gsStateChannel <- agonesv1.GameServerStateShutdown
}()
}
}

return nil
}

Expand Down

0 comments on commit b1b48e1

Please sign in to comment.