From aeceacd9177ba12b1944c62f2d13ec5a31ac0f4e Mon Sep 17 00:00:00 2001 From: Cnly Date: Thu, 27 Jun 2019 04:33:45 +0800 Subject: [PATCH] Make Notifier.CurrentPosition() respect stream lock Signed-off-by: Alex Chen --- syncapi/sync/notifier.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/syncapi/sync/notifier.go b/syncapi/sync/notifier.go index b182e86ee..49a34adfa 100644 --- a/syncapi/sync/notifier.go +++ b/syncapi/sync/notifier.go @@ -141,6 +141,9 @@ func (n *Notifier) Load(ctx context.Context, db *storage.SyncServerDatasource) e // CurrentPosition returns the current stream position func (n *Notifier) CurrentPosition() types.SyncPosition { + n.streamLock.Lock() + defer n.streamLock.Unlock() + return n.currPos }