From 74eb975e4dec142aae0e7d993aa90db666136350 Mon Sep 17 00:00:00 2001 From: arnaudberger Date: Thu, 16 May 2024 14:56:26 -0400 Subject: [PATCH] Fix expectedStarBlock once restarted using cursor --- sinker.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sinker.go b/sinker.go index 512c3c8..f49bd8c 100644 --- a/sinker.go +++ b/sinker.go @@ -39,7 +39,7 @@ func NewFileSinker(sinker *sink.Sinker, bundler *bundler.Bundler, encoder encode func (fs *FileSinker) Run(ctx context.Context) error { cursor, err := fs.bundler.GetCursor() if err != nil { - return fmt.Errorf("faile to read curosor: %w", err) + return fmt.Errorf("faile to read cursor: %w", err) } fs.Sinker.OnTerminating(fs.Shutdown) @@ -58,13 +58,13 @@ func (fs *FileSinker) Run(ctx context.Context) error { expectedStartBlock := uint64(0) if !cursor.IsBlank() { - expectedStartBlock = cursor.Block().Num() + expectedStartBlock = cursor.Block().Num() + 1 } else if blockRange := fs.BlockRange(); blockRange != nil { expectedStartBlock = blockRange.StartBlock() } if err := fs.bundler.Start(expectedStartBlock); err != nil { - return fmt.Errorf("unable to start bunlder: %w", err) + return fmt.Errorf("unable to start bundler: %w", err) } fs.logger.Info("starting file sink", zap.Stringer("restarting_at", cursor.Block()))