Skip to content

Commit

Permalink
Merge pull request #35 from moonstream-to/fix-gcs-close
Browse files Browse the repository at this point in the history
Fix missing close.
  • Loading branch information
kompotkot authored Jul 10, 2024
2 parents e435f32 + df13f7b commit 2b20aa6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions storage/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import (
func NewStorage(storageType, basePath string) (Storer, error) {
switch storageType {
case "filesystem":
log.Println("Using filesystem storage")
return NewFileStorage(basePath), nil
case "gcp-storage":
// Google Cloud Storage
ctx := context.Background()
log.Println("Creating GCS client")

var client *gcp_storage.Client
var clientErr error
Expand Down
4 changes: 4 additions & 0 deletions storage/gcp_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ func (g *GCS) Save(batchDir, filename string, bf bytes.Buffer) error {
return fmt.Errorf("failed to write object to bucket: %v", err)
}

if err := wc.Close(); err != nil {
return fmt.Errorf("failed to close writer: %v", err)
}

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package version

var SeerVersion string = "0.1.8"
var SeerVersion string = "0.1.9"

0 comments on commit 2b20aa6

Please sign in to comment.