Skip to content

Commit

Permalink
Added logs on server termination and facility to restart it if termin…
Browse files Browse the repository at this point in the history
…ated
  • Loading branch information
Utkarsh Shukla committed Dec 12, 2024
1 parent 78a4e70 commit c224cca
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions internal/serviceconfig/service_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ func RunHTTPSServer(ctx context.Context, em EchoManager, routes Destinations, tl
Addr: fmt.Sprintf(":%d", service.Port),
Handler: mux,
}

defer func() {
logger.infoW("RunHTTPSServer Server stopped! with service",service.Name)

Check failure on line 68 in internal/serviceconfig/service_server.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

logger.infoW undefined (type *zap.SugaredLogger has no field or method infoW)

Check failure on line 68 in internal/serviceconfig/service_server.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

logger.infoW undefined (type *zap.SugaredLogger has no field or method infoW)
logger.infoW("Restarting it!")

Check failure on line 69 in internal/serviceconfig/service_server.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

logger.infoW undefined (type *zap.SugaredLogger has no field or method infoW)

Check failure on line 69 in internal/serviceconfig/service_server.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

logger.infoW undefined (type *zap.SugaredLogger has no field or method infoW)
RunHTTPSServer(ctx, em, routes, tlsPath, service)
}()
addDefaults(ctx, server)

if tlsPath != "" {
Expand All @@ -88,7 +92,11 @@ func RunHTTPServer(ctx context.Context, em EchoManager, routes Destinations, ser
mux := http.NewServeMux()

mux.HandleFunc("/", fixedIdentityAPIHandlerMaker(em, routes, service))

defer func() {
logger.infoW("RunHTTPServer Server stopped! with service",service.Name)

Check failure on line 96 in internal/serviceconfig/service_server.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

logger.infoW undefined (type *zap.SugaredLogger has no field or method infoW)

Check failure on line 96 in internal/serviceconfig/service_server.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

logger.infoW undefined (type *zap.SugaredLogger has no field or method infoW)
logger.infoW("Restarting it!")

Check failure on line 97 in internal/serviceconfig/service_server.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

logger.infoW undefined (type *zap.SugaredLogger has no field or method infoW)

Check failure on line 97 in internal/serviceconfig/service_server.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

logger.infoW undefined (type *zap.SugaredLogger has no field or method infoW)
RunHTTPServer(ctx, em, routes, tlsPath, service)

Check failure on line 98 in internal/serviceconfig/service_server.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: tlsPath

Check failure on line 98 in internal/serviceconfig/service_server.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

too many arguments in call to RunHTTPServer

Check failure on line 98 in internal/serviceconfig/service_server.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: tlsPath

Check failure on line 98 in internal/serviceconfig/service_server.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

too many arguments in call to RunHTTPServer
}()
server := &http.Server{
Addr: fmt.Sprintf(":%d", service.Port),
Handler: mux,
Expand Down

0 comments on commit c224cca

Please sign in to comment.