diff --git a/packages/nylas-sync/sync-worker.js b/packages/nylas-sync/sync-worker.js index 41811c4d5..2371fdddb 100644 --- a/packages/nylas-sync/sync-worker.js +++ b/packages/nylas-sync/sync-worker.js @@ -131,12 +131,13 @@ class SyncWorker { } runSyncbackTask(task) { + const syncbackRequest = task.syncbackRequestObject() return this._conn.runOperation(task) - .then(() => { task.syncbackRequest.status = "SUCCEEDED" }) + .then(() => { syncbackRequest.status = "SUCCEEDED" }) .catch((error) => { - task.syncbackRequest.error = error - task.syncbackRequest.status = "FAILED" - }).finally(() => task.syncbackRequest.save()) + syncbackRequest.error = error + syncbackRequest.status = "FAILED" + }).finally(() => syncbackRequest.save()) } syncAllCategories() { diff --git a/packages/nylas-sync/syncback_tasks/move-to-folder.imap.js b/packages/nylas-sync/syncback_tasks/move-to-folder.imap.js index cfeebeb1b..acb697878 100644 --- a/packages/nylas-sync/syncback_tasks/move-to-folder.imap.js +++ b/packages/nylas-sync/syncback_tasks/move-to-folder.imap.js @@ -4,6 +4,10 @@ class MoveToFolderIMAP { this._syncbackRequest = syncbackRequest; } + syncbackRequestObject() { + return this._syncbackRequest; + } + description() { return `MoveToFolder`; }