You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-12-02 22:49:09 +02:00
Better handling of network errors
This commit is contained in:
@@ -126,19 +126,25 @@ reg.scheduleSync = async (delay = null) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const sync = await reg.synchronizer(syncTargetId);
|
||||
|
||||
let context = Setting.value('sync.context');
|
||||
context = context ? JSON.parse(context) : {};
|
||||
try {
|
||||
let newContext = await sync.start({ context: context });
|
||||
Setting.setValue('sync.context', JSON.stringify(newContext));
|
||||
} catch (error) {
|
||||
if (error.code == 'alreadyStarted') {
|
||||
reg.logger().info(error.message);
|
||||
} else {
|
||||
throw error;
|
||||
const sync = await reg.synchronizer(syncTargetId);
|
||||
|
||||
|
||||
let context = Setting.value('sync.context');
|
||||
context = context ? JSON.parse(context) : {};
|
||||
try {
|
||||
let newContext = await sync.start({ context: context });
|
||||
Setting.setValue('sync.context', JSON.stringify(newContext));
|
||||
} catch (error) {
|
||||
if (error.code == 'alreadyStarted') {
|
||||
reg.logger().info(error.message);
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
reg.logger().info('Could not run background sync: ');
|
||||
reg.logger().info(error);
|
||||
}
|
||||
|
||||
reg.setupRecurrentSync();
|
||||
|
||||
Reference in New Issue
Block a user