diff --git a/packages/local-sync/src/local-sync-worker/sync-worker.js b/packages/local-sync/src/local-sync-worker/sync-worker.js index d7ee65630..ba4168d24 100644 --- a/packages/local-sync/src/local-sync-worker/sync-worker.js +++ b/packages/local-sync/src/local-sync-worker/sync-worker.js @@ -4,7 +4,6 @@ const { PromiseUtils, } = require('isomorphic-core'); const LocalDatabaseConnector = require('../shared/local-database-connector') -const MessageTypes = require('../shared/message-types') const { jsonError, } = require('./sync-utils') @@ -28,8 +27,6 @@ class SyncWorker { this._destroyed = false; this.syncNow({reason: 'Initial'}); - - this._onMessage = this._onMessage.bind(this); } cleanup() { @@ -45,27 +42,6 @@ class SyncWorker { } } - _onMessage(msg) { - const {type} = JSON.parse(msg); - switch (type) { - case MessageTypes.ACCOUNT_CREATED: - // No other processing currently required for account creation - break; - case MessageTypes.ACCOUNT_UPDATED: - this._onAccountUpdated(); - break; - case MessageTypes.ACCOUNT_DELETED: - this.cleanup(); - this._onExpired(); - break; - case MessageTypes.SYNCBACK_REQUESTED: - this.syncNow({reason: 'Syncback Action Queued'}); - break; - default: - this._logger.error({message: msg}, 'SyncWorker: Invalid message') - } - } - _onAccountUpdated() { const syncingNow = !this.isWaitingForNextSync() const syncingJustFinished = (Date.now() - this._lastSyncTime < 5000); diff --git a/packages/local-sync/src/shared/message-types.js b/packages/local-sync/src/shared/message-types.js deleted file mode 100644 index 43bbb3ba6..000000000 --- a/packages/local-sync/src/shared/message-types.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - ACCOUNT_CREATED: "ACCOUNT_CREATED", - ACCOUNT_UPDATED: "ACCOUNT_UPDATED", - ACCOUNT_DELETED: "ACCOUNT_DELETED", - SYNCBACK_REQUESTED: "SYNCBACK_REQUESTED", -}