mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-03-03 19:43:04 +08:00
Allow firstSyncCompletion to be null
This commit is contained in:
parent
84d8979265
commit
dfa16fb5fc
2 changed files with 7 additions and 3 deletions
|
@ -12,7 +12,11 @@ module.exports = (sequelize, Sequelize) => {
|
|||
connectionCredentials: Sequelize.TEXT,
|
||||
syncPolicy: JSONType('syncPolicy'),
|
||||
syncError: JSONType('syncError', {defaultValue: null}),
|
||||
firstSyncCompletion: Sequelize.INTEGER(14),
|
||||
firstSyncCompletion: {
|
||||
type: Sequelize.INTEGER(14),
|
||||
allowNull: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
lastSyncCompletions: JSONARRAYType('lastSyncCompletions'),
|
||||
}, {
|
||||
classMethods: {
|
||||
|
|
|
@ -208,12 +208,12 @@ class SyncWorker {
|
|||
|
||||
onSyncDidComplete() {
|
||||
const {afterSync} = this._account.syncPolicy;
|
||||
const now = Date.now();
|
||||
|
||||
if (!this._account.firstSyncCompletion) {
|
||||
this._account.firstSyncCompletion = Date.now()
|
||||
this._account.firstSyncCompletion = now;
|
||||
}
|
||||
|
||||
const now = Date.now();
|
||||
const syncGraphTimeLength = 60 * 30; // 30 minutes, should be the same as SyncGraph.config.timeLength
|
||||
let lastSyncCompletions = [].concat(this._account.lastSyncCompletions)
|
||||
lastSyncCompletions = [now, ...lastSyncCompletions]
|
||||
|
|
Loading…
Reference in a new issue