Index: server/logdog/storage/archive/storage.go |
diff --git a/server/logdog/storage/archive/storage.go b/server/logdog/storage/archive/storage.go |
index 159cb27d11b7aed236189995b982172c3f8b003e..5b0d6caa3bb5f61b441cda350adbc38b83d77dd1 100644 |
--- a/server/logdog/storage/archive/storage.go |
+++ b/server/logdog/storage/archive/storage.go |
@@ -53,7 +53,7 @@ type Options struct { |
// Client is the HTTP client to use for authentication. |
// |
- // Closing this Storage instance does not close the underlying Client. |
+ // Closing this Storage instance will close the underlying Client. |
Client gs.Client |
} |
@@ -66,9 +66,8 @@ type storageImpl struct { |
indexBucket string |
indexPath string |
- indexMu sync.Mutex |
- index *logpb.LogIndex |
- closeClient bool |
+ indexMu sync.Mutex |
+ index *logpb.LogIndex |
} |
// New instantiates a new Storage instance, bound to the supplied Options. |
@@ -94,18 +93,14 @@ func New(c context.Context, o Options) (storage.Storage, error) { |
if err != nil { |
return nil, err |
} |
- |
- s.closeClient = true |
} |
return &s, nil |
} |
func (s *storageImpl) Close() { |
- if s.closeClient { |
- if err := s.Client.Close(); err != nil { |
- log.WithError(err).Errorf(s, "Failed to close client.") |
- } |
+ if err := s.Client.Close(); err != nil { |
+ log.WithError(err).Errorf(s, "Failed to close client.") |
} |
} |
@@ -320,7 +315,7 @@ func (s *storageImpl) buildGetStrategy(req *storage.GetRequest, idx *logpb.LogIn |
// for sure that we have one LogEntry per index entry, so that's the best we |
// can do. |
if req.Limit > 0 { |
- if ub := startIdx + req.Limit; ub < len(idx.Entries) { |
+ if ub := int64(startIdx) + req.Limit; ub < int64(len(idx.Entries)) { |
st.to = int64(idx.Entries[ub].Offset) |
} |
} |