Skip to content

Commit ff20eaa

Browse files
committed
fix shutdown logic
1 parent 3c09cd7 commit ff20eaa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sinker/sinker.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ func (s *SQLSinker) Run(ctx context.Context) {
8484
s.logger.Info("sql sinker terminated", zap.Stringer("last_block_written", s.stats.lastBlock), zap.Error(err))
8585
s.Shutdown(err)
8686
})
87-
s.OnTerminating(s.Sinker.Shutdown)
88-
89-
s.stats.OnTerminating(func(_ error) { s.stats.Close() })
87+
s.OnTerminating(func(err error) {
88+
s.Sinker.Shutdown(err)
89+
s.stats.Close()
90+
})
9091
s.stats.OnTerminated(func(err error) { s.Shutdown(err) })
9192

9293
logEach := 15 * time.Second

0 commit comments

Comments
 (0)