Skip to content

Commit

Permalink
recover blob state from batcher
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-shim committed Jul 23, 2024
1 parent 3285f41 commit 48579c4
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion disperser/batcher/batcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,26 @@ func NewBatcher(
}, nil
}

func (b *Batcher) RecoverState(ctx context.Context) error {
metas, err := b.Queue.GetBlobMetadataByStatus(ctx, disperser.Dispersing)
if err != nil {
return fmt.Errorf("failed to get blobs in dispersing state: %w", err)
}
for _, meta := range metas {
err = b.Queue.MarkBlobProcessing(ctx, meta.GetBlobKey())
if err != nil {
b.logger.Error("failed to mark blob as processing", "blobKey", meta.GetBlobKey(), "err", err)
}
}
return nil
}

func (b *Batcher) Start(ctx context.Context) error {
err := b.ChainState.Start(ctx)
err := b.RecoverState(ctx)
if err != nil {
b.logger.Error("failed to recover state", "err", err)
}
err = b.ChainState.Start(ctx)
if err != nil {
return err
}
Expand Down

0 comments on commit 48579c4

Please sign in to comment.