Use utils.LogClose for deferred closing in miniogw (#239)
This commit is contained in:
parent
906643fce2
commit
ae430b8c10
@ -18,6 +18,7 @@ import (
|
|||||||
"storj.io/storj/pkg/storage/buckets"
|
"storj.io/storj/pkg/storage/buckets"
|
||||||
"storj.io/storj/pkg/storage/meta"
|
"storj.io/storj/pkg/storage/meta"
|
||||||
"storj.io/storj/pkg/storage/objects"
|
"storj.io/storj/pkg/storage/objects"
|
||||||
|
"storj.io/storj/pkg/utils"
|
||||||
"storj.io/storj/storage"
|
"storj.io/storj/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -111,22 +112,12 @@ func (s *storjObjects) GetObject(ctx context.Context, bucket, object string,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer func() {
|
defer utils.LogClose(rr)
|
||||||
if err := rr.Close(); err != nil {
|
|
||||||
// ignore for now
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
r, err := rr.Range(ctx, startOffset, length)
|
r, err := rr.Range(ctx, startOffset, length)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer utils.LogClose(r)
|
||||||
defer func() {
|
|
||||||
if err = r.Close(); err != nil {
|
|
||||||
// ignore for now
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
_, err = io.Copy(writer, r)
|
_, err = io.Copy(writer, r)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user