mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-21 07:46:06 +08:00
[local-sync] Remove unused message-types
This commit is contained in:
parent
43030789a8
commit
f45425a7b6
|
@ -4,7 +4,6 @@ const {
|
||||||
PromiseUtils,
|
PromiseUtils,
|
||||||
} = require('isomorphic-core');
|
} = require('isomorphic-core');
|
||||||
const LocalDatabaseConnector = require('../shared/local-database-connector')
|
const LocalDatabaseConnector = require('../shared/local-database-connector')
|
||||||
const MessageTypes = require('../shared/message-types')
|
|
||||||
const {
|
const {
|
||||||
jsonError,
|
jsonError,
|
||||||
} = require('./sync-utils')
|
} = require('./sync-utils')
|
||||||
|
@ -28,8 +27,6 @@ class SyncWorker {
|
||||||
this._destroyed = false;
|
this._destroyed = false;
|
||||||
|
|
||||||
this.syncNow({reason: 'Initial'});
|
this.syncNow({reason: 'Initial'});
|
||||||
|
|
||||||
this._onMessage = this._onMessage.bind(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup() {
|
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() {
|
_onAccountUpdated() {
|
||||||
const syncingNow = !this.isWaitingForNextSync()
|
const syncingNow = !this.isWaitingForNextSync()
|
||||||
const syncingJustFinished = (Date.now() - this._lastSyncTime < 5000);
|
const syncingJustFinished = (Date.now() - this._lastSyncTime < 5000);
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
ACCOUNT_CREATED: "ACCOUNT_CREATED",
|
|
||||||
ACCOUNT_UPDATED: "ACCOUNT_UPDATED",
|
|
||||||
ACCOUNT_DELETED: "ACCOUNT_DELETED",
|
|
||||||
SYNCBACK_REQUESTED: "SYNCBACK_REQUESTED",
|
|
||||||
}
|
|
Loading…
Reference in a new issue