From f6671c33de575c8a70ae9104afd06e4dcd181653 Mon Sep 17 00:00:00 2001 From: LightQuantum Date: Tue, 4 Jun 2024 23:14:19 +0800 Subject: [PATCH] feat: log when checkpoint fails --- pkg/manager/manager.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pkg/manager/manager.go b/pkg/manager/manager.go index 2867610..690f43e 100644 --- a/pkg/manager/manager.go +++ b/pkg/manager/manager.go @@ -220,7 +220,13 @@ func (m *Manager) Run() { }).Debugf("Calling RunSync() to w %s", w.GetConfig()["name"]) go w.RunSync() } - m.checkpoint() + err := m.checkpoint() + if err != nil { + m.logger.WithFields(logrus.Fields{ + "event": "checkpoint_failed", + "error": err, + }).Error("Failed to checkpoint") + } for { // wait until config.Interval seconds has elapsed select { @@ -264,7 +270,13 @@ func (m *Manager) Run() { // Here we do not checkpoint very concisely (e.g. every time after a successful sync). // We just want to minimize re-sync after restarting lug. if shouldCheckpoint { - m.checkpoint() + err := m.checkpoint() + if err != nil { + m.logger.WithFields(logrus.Fields{ + "event": "checkpoint_failed", + "error": err, + }).Error("Failed to checkpoint") + } } } case sig, ok := <-m.controlChan: