fix: add deadline to jwk register
All checks were successful
Docker Build and Push / build-and-push-tags (push) Has been skipped
renovate / renovate (push) Successful in 44s
Docker Build and Push / build-and-push-branches (push) Successful in 4m0s

This commit is contained in:
2026-01-04 17:10:28 +07:00
parent a98682d42f
commit 6124df8911
2 changed files with 10 additions and 7 deletions

View File

@@ -28,6 +28,7 @@ import (
const (
defaultSubscriberResponseWait = 5 * time.Second
jwkRegisterTimeout = 5 * time.Second
)
type Subscriber struct {
@@ -352,10 +353,12 @@ func (s *Server) StartAPI(ctx context.Context, Addr string) error {
WriteTimeout: 15 * time.Second,
IdleTimeout: 60 * time.Second,
}
jwkURL := config.Getenv("JWKS_URL", "")
if jwkURL != "" {
if err := s.jwkCache.Register(ctx, jwkURL); err != nil {
registerCtx, cancel := context.WithTimeout(ctx, jwkRegisterTimeout)
defer cancel()
if err := s.jwkCache.Register(registerCtx, jwkURL); err != nil {
return fmt.Errorf("failed to register jwk cache: %w", err)
}
}