complete the checkpoint. Pass nil to indicate the checkpoint was ok. It is an error to call this more than once.
(err error)
| 21 | // complete the checkpoint. Pass nil to indicate the checkpoint was ok. It is an error to call this |
| 22 | // more than once. |
| 23 | func (c *checkpoint) complete(err error) { |
| 24 | c.mu.Lock() |
| 25 | defer c.mu.Unlock() |
| 26 | if c.called { |
| 27 | b := make([]byte, 2048) |
| 28 | n := runtime.Stack(b, false) |
| 29 | c.logger.Critical(context.Background(), "checkpoint complete called more than once", slog.F("stacktrace", b[:n])) |
| 30 | return |
| 31 | } |
| 32 | c.called = true |
| 33 | c.err = err |
| 34 | close(c.done) |
| 35 | } |
| 36 | |
| 37 | func (c *checkpoint) wait(ctx context.Context) error { |
| 38 | select { |