diff --git a/pkg/http/collection.go b/pkg/http/collection.go index a12976c2..7472003b 100644 --- a/pkg/http/collection.go +++ b/pkg/http/collection.go @@ -7,7 +7,7 @@ import ( "github.com/gin-contrib/timeout" "github.com/gin-gonic/gin" "github.com/riotkit-org/backup-repository/pkg/core" - health2 "github.com/riotkit-org/backup-repository/pkg/health" + "github.com/riotkit-org/backup-repository/pkg/health" "github.com/riotkit-org/backup-repository/pkg/security" "github.com/riotkit-org/backup-repository/pkg/storage" "github.com/sirupsen/logrus" @@ -171,6 +171,7 @@ func addDownloadRoute(r *gin.RouterGroup, ctx *core.ApplicationContainer, reques // Read from storage middlewares := storage.NestedStreamMiddlewares{} stream, err := ctx.Storage.ReadFile(c.Request.Context(), version.GetTargetPath()) + defer stream.Close() if err != nil { ServerErrorResponse(c, errors.New(fmt.Sprintf("cannot read from storage: %v", err))) return @@ -214,10 +215,10 @@ func addCollectionHealthRoute(r *gin.Engine, ctx *core.ApplicationContainer, rat } // Run all the checks - healthStatuses := health2.Validators{ - health2.NewBackupWindowValidator(ctx.Storage, collection), - health2.NewVersionsSizeValidator(ctx.Storage, collection), - health2.NewSumOfVersionsValidator(ctx.Storage, collection), + healthStatuses := health.Validators{ + health.NewBackupWindowValidator(ctx.Storage, collection), + health.NewVersionsSizeValidator(ctx.Storage, collection), + health.NewSumOfVersionsValidator(ctx.Storage, collection), }.Validate() if !healthStatuses.GetOverallStatus() { diff --git a/pkg/http/health.go b/pkg/http/health.go index c87313c5..98fc2e25 100644 --- a/pkg/http/health.go +++ b/pkg/http/health.go @@ -5,7 +5,7 @@ import ( "github.com/gin-gonic/gin" "github.com/pkg/errors" "github.com/riotkit-org/backup-repository/pkg/core" - health2 "github.com/riotkit-org/backup-repository/pkg/health" + health "github.com/riotkit-org/backup-repository/pkg/health" "github.com/sirupsen/logrus" ) @@ -29,10 +29,10 @@ func addServerHealthEndpoints(r *gin.Engine, ctx *core.ApplicationContainer, rat return } - healthStatuses := health2.Validators{ - health2.NewDbValidator(ctx.Db), - health2.NewStorageValidator(ctx.Storage, context.Background(), ctx.Storage.HealthTimeout), - health2.NewConfigurationProviderValidator(*ctx.Config), + healthStatuses := health.Validators{ + health.NewDbValidator(ctx.Db), + health.NewStorageValidator(ctx.Storage, context.Background(), ctx.Storage.HealthTimeout), + health.NewConfigurationProviderValidator(*ctx.Config), }.Validate() if !healthStatuses.GetOverallStatus() {