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