From 6dc4facba07bf711838e0db4f7ea9fd556b950fb Mon Sep 17 00:00:00 2001 From: Jesse Peterson Date: Fri, 1 Oct 2021 15:07:51 -0700 Subject: [PATCH] Process devices before we sync (#779) --- platform/dep/sync/depsync.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/dep/sync/depsync.go b/platform/dep/sync/depsync.go index bdcdbf1a..13c11d08 100644 --- a/platform/dep/sync/depsync.go +++ b/platform/dep/sync/depsync.go @@ -3,6 +3,7 @@ package sync import ( "context" "encoding/json" + "fmt" "strings" "sync" "time" @@ -327,13 +328,13 @@ func (w *Watcher) Run() error { "more", resp.MoreToFollow, ) + if err := w.publishAndProcessDevices(resp.Devices); err != nil { + return fmt.Errorf("publish and process devices: %w", err) + } w.cursor = Cursor{Value: resp.Cursor, CreatedAt: time.Now()} if err := w.db.SaveCursor(w.cursor); err != nil { return errors.Wrap(err, "saving cursor from fetch") } - if err := w.publishAndProcessDevices(resp.Devices); err != nil { - return err - } if resp.MoreToFollow { continue