Skip to content

Commit

Permalink
minor edit
Browse files Browse the repository at this point in the history
  • Loading branch information
Utkarsh Shukla committed Dec 17, 2024
1 parent b88308a commit d7c00d0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/serviceconfig/service_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"strings"
"time"
"os"
"syscall"

"github.com/opsmx/oes-birger/internal/jwtutil"
"github.com/opsmx/oes-birger/internal/logging"
Expand Down Expand Up @@ -98,7 +97,7 @@ func RunHTTPSServer(ctx context.Context, em EchoManager, routes Destinations, tl
}

func gracefulShutdown(server *http.Server, ctx context.Context){
logger := logger.WithContext(ctx).Sugar()
logger := logging.WithContext(ctx).Sugar()
logger.Infof("Received signal: %v. Initiating graceful shutdown...\n")

// Create a context with timeout for the shutdown process
Expand All @@ -113,7 +112,7 @@ func gracefulShutdown(server *http.Server, ctx context.Context){
}

// sigchan <- syscall.SIGTERM
os.exit(0)
os.Exit(0)
}

// RunHTTPServer will listen on an unencrypted HTTP only port, and will always forward
Expand All @@ -136,7 +135,7 @@ func RunHTTPServer(ctx context.Context, em EchoManager, routes Destinations, ser
// logger.Fatal(server.ListenAndServe())
if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
logger.Errorf("Error received on server: %v", err)
gracefulShutdown(server)
gracefulShutdown(server, ctx)
}
defer func() {
logger.Infow("RunHTTPSServer Server stopped! with service",service.Name)
Expand Down

0 comments on commit d7c00d0

Please sign in to comment.