From 2511902d9d447b130d40480b29be43b2d5007827 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 16 Apr 2024 22:01:11 +0200 Subject: [PATCH] Update kit version --- cmd/api/api.go | 10 ++++++---- cmd/cli/cli.go | 1 + cmd/worker/worker.go | 1 + go.mod | 2 +- go.sum | 4 ++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/cmd/api/api.go b/cmd/api/api.go index 866bed9..f612f47 100644 --- a/cmd/api/api.go +++ b/cmd/api/api.go @@ -128,21 +128,22 @@ func NewAPI(ctx context.Context, config config.Config) (*API, error) { }) observerMiddleware := kitMiddleware.NewObserver(observer, kitMiddleware.ObserverConfig{}) + timeoutMiddleware := kitMiddleware.NewTimeout(observer, kitMiddleware.TimeoutConfig{ + // Allow timeout handler to respond before response writer is closed + Timeout: config.Service.GracefulTimeout - (1 * time.Second), + }) recoverMiddleware := kitMiddleware.NewRecover(observer, kitMiddleware.RecoverConfig{}) secureMiddleware := kitMiddleware.NewSecure(observer, kitMiddleware.SecureConfig{ CORSAllowOrigins: kitUtil.Pointer(config.Server.Origins), }) localizerMiddleware := kitMiddleware.NewLocalizer(observer, localizer, kitMiddleware.LocalizerConfig{}) - timeoutMiddleware := kitMiddleware.NewTimeout(observer, kitMiddleware.TimeoutConfig{ - Timeout: config.Service.GracefulTimeout, - }) errorMiddleware := kitMiddleware.NewError(observer, kitMiddleware.ErrorConfig{}) server.Use(observerMiddleware.HandleRequest) + server.Use(timeoutMiddleware.Handle) server.Use(recoverMiddleware.HandleRequest) server.Use(secureMiddleware.Handle) server.Use(localizerMiddleware.Handle) - server.Use(timeoutMiddleware.Handle) server.Use(errorMiddleware.Handle) api := server.Default() @@ -193,6 +194,7 @@ func NewAPI(ctx context.Context, config config.Config) (*API, error) { CacheReadTimeout: kitUtil.Pointer(config.Cache.ReadTimeout), CacheWriteTimeout: kitUtil.Pointer(config.Cache.WriteTimeout), CacheDialTimeout: kitUtil.Pointer(config.Cache.DialTimeout), + TaskDefaultRetry: kitUtil.Pointer(0), }) /* REPOSITORIES */ diff --git a/cmd/cli/cli.go b/cmd/cli/cli.go index 57b988a..7254dc7 100644 --- a/cmd/cli/cli.go +++ b/cmd/cli/cli.go @@ -143,6 +143,7 @@ func NewCLI(ctx context.Context, config config.Config) (*CLI, error) { CacheReadTimeout: kitUtil.Pointer(config.Cache.ReadTimeout), CacheWriteTimeout: kitUtil.Pointer(config.Cache.WriteTimeout), CacheDialTimeout: kitUtil.Pointer(config.Cache.DialTimeout), + TaskDefaultRetry: kitUtil.Pointer(0), }) /* REPOSITORIES */ diff --git a/cmd/worker/worker.go b/cmd/worker/worker.go index f4fa774..9c6eb42 100644 --- a/cmd/worker/worker.go +++ b/cmd/worker/worker.go @@ -171,6 +171,7 @@ func NewWorker(ctx context.Context, config config.Config) (*Worker, error) { CacheReadTimeout: kitUtil.Pointer(config.Cache.ReadTimeout), CacheWriteTimeout: kitUtil.Pointer(config.Cache.WriteTimeout), CacheDialTimeout: kitUtil.Pointer(config.Cache.DialTimeout), + TaskDefaultRetry: kitUtil.Pointer(0), }) /* REPOSITORIES */ diff --git a/go.mod b/go.mod index c711a09..abf5b3d 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/leporo/sqlf v1.4.0 github.com/mkideal/cli v0.2.7 github.com/neoxelox/errors v0.2.0 - github.com/neoxelox/kit v0.30.0 + github.com/neoxelox/kit v0.33.0 github.com/rs/xid v1.5.0 golang.org/x/text v0.14.0 ) diff --git a/go.sum b/go.sum index 6bf3931..903f309 100644 --- a/go.sum +++ b/go.sum @@ -221,8 +221,8 @@ github.com/neoxelox/errors v0.2.0 h1:AhvCMJAjUBFCP3PgZHbY6SS8Sc9fxx/DiawU5Cd5RxE github.com/neoxelox/errors v0.2.0/go.mod h1:gCPnC7z8Qwswwz5Usv3WORxvan9Q6WSrDTvzaQyl7oM= github.com/neoxelox/gilk v0.5.0 h1:Knw/TgSUnwPDIRJbqoTmG98gYsmKojNCJ5WAjALoWFc= github.com/neoxelox/gilk v0.5.0/go.mod h1:Q+WgmSMKWd5UAaVjLSmGPbVD11AmHFhlo3QrPum0vo0= -github.com/neoxelox/kit v0.30.0 h1:Rpp/WKYZ/QDcPuFZrfyaA2aMYBzjJFoD3TNE0xjQbuw= -github.com/neoxelox/kit v0.30.0/go.mod h1:IgYpZ0XID15bSpHXCnrJA6to5j69fzkbn0knfsEpdAE= +github.com/neoxelox/kit v0.33.0 h1:9IlIuwVP3Bb+herHpDTLYEA9vFUKGCD1C67LD2hr3U8= +github.com/neoxelox/kit v0.33.0/go.mod h1:IgYpZ0XID15bSpHXCnrJA6to5j69fzkbn0knfsEpdAE= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=