Skip to content

Commit

Permalink
Fix: saving blobs (#212)
Browse files Browse the repository at this point in the history
* Fix: saving blobs

* Fix: nil pointer
  • Loading branch information
aopoltorzhicky authored Jun 9, 2024
1 parent 25dca60 commit ffa8466
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/blob/r2.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func NewR2(cfg R2Config) R2 {
r2 := R2{
cfg: cfg,
}
r2.pool = workerpool.NewPool(r2.saveBlob, 16)

return r2
}
Expand All @@ -72,6 +71,7 @@ func (r2 *R2) Init(ctx context.Context) error {
}

r2.client = serviceS3.NewFromConfig(cfg)
r2.pool = workerpool.NewPool(r2.saveBlob, 16)
r2.pool.Start(ctx)
return nil
}
Expand Down Expand Up @@ -175,7 +175,7 @@ func (r2 R2) Blobs(ctx context.Context, height pkgTypes.Level, hash ...string) (
return nil, errors.New("not implemented")
}

func (r2 R2) saveBlob(ctx context.Context, blob Blob) {
func (r2 *R2) saveBlob(ctx context.Context, blob Blob) {
timeoutCtx, cancel := context.WithTimeout(ctx, time.Second*30)
defer cancel()

Expand Down

0 comments on commit ffa8466

Please sign in to comment.