Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ spec:
httpGet:
path: /ping
port: http
{{- if .Values.tls.enabled }}
scheme: HTTPS
{{- end }}
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
Expand All @@ -97,6 +100,9 @@ spec:
httpGet:
path: /health
port: http
{{- if .Values.tls.enabled }}
scheme: HTTPS
{{- end }}
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 3
Expand Down
11 changes: 10 additions & 1 deletion src/internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net/http"
"time"

"github.com/gin-gonic/gin"
"github.com/kevingruber/gradle-cache/internal/config"
Expand Down Expand Up @@ -159,7 +160,15 @@ func (s *Server) Run(ctx context.Context) error {
select {
case <-ctx.Done():
s.logger.Info().Msg("shutting down server")
return srv.Shutdown(context.Background())

shutdownCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

if err := srv.Shutdown(shutdownCtx); err != nil {
return fmt.Errorf("server shutdown failed %w", err)

}
return nil
case err := <-errCh:
return err
}
Expand Down