From 2c6a7201efef6d5600901e8bbe9030778171f2c1 Mon Sep 17 00:00:00 2001 From: Max Ignatenko Date: Thu, 14 Nov 2024 12:17:01 +0000 Subject: [PATCH] fix: actually store the queried timestamp in the struct --- cmd/plc-mirror/mirror.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/plc-mirror/mirror.go b/cmd/plc-mirror/mirror.go index 03ee903..489b2a6 100644 --- a/cmd/plc-mirror/mirror.go +++ b/cmd/plc-mirror/mirror.go @@ -112,11 +112,11 @@ func (m *Mirror) LastRecordTimestamp(ctx context.Context) (time.Time, error) { m.mu.Lock() defer m.mu.Unlock() - if t.IsZero() { - t = dbTimestamp + if m.lastRecordTimestamp.IsZero() { + m.lastRecordTimestamp = dbTimestamp } - if t.After(dbTimestamp) { - return t, nil + if m.lastRecordTimestamp.After(dbTimestamp) { + return m.lastRecordTimestamp, nil } return dbTimestamp, nil }