1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

sync in bg

This commit is contained in:
Laurent Cozic
2017-07-24 19:47:01 +00:00
parent a983a9f108
commit 3e1decdfa6
10 changed files with 75 additions and 18 deletions

View File

@ -148,6 +148,15 @@ class Synchronizer {
async start(options = null) {
if (!options) options = {};
if (this.state() != 'idle') {
let error = new Error(_('Synchronization is already in progress. State: %s', this.state()));
error.code = 'alreadyStarted';
throw error;
//this.logger().info('Synchronization is already in progress. State: ' + this.state());
return;
}
this.onProgress_ = options.onProgress ? options.onProgress : function(o) {};
this.progressReport_ = { errors: [] };
@ -155,11 +164,6 @@ class Synchronizer {
const syncTargetId = this.api().syncTargetId();
if (this.state() != 'idle') {
this.logger().info('Synchronization is already in progress. State: ' + this.state());
return;
}
this.randomFailureChoice_ = Math.floor(Math.random() * 5);
this.cancelling_ = false;