Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
fix: `A blob.Reader reading from "iwa-ait/iwa-ait-2.tar.gz" was never…
Browse files Browse the repository at this point in the history
… closed (/home/user/GolandProjects/backup-repository/pkg/storage/service.go:210)`
  • Loading branch information
B&R committed Oct 8, 2023
1 parent 50d15b3 commit fc19777
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
11 changes: 6 additions & 5 deletions pkg/http/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down
10 changes: 5 additions & 5 deletions pkg/http/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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() {
Expand Down

0 comments on commit fc19777

Please sign in to comment.