1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-06 09:19:22 +02:00

Desktop: Fixed clock sync logic when creating new sync target

This commit is contained in:
Laurent Cozic
2020-09-11 23:33:34 +01:00
parent 2aa7eaa192
commit 0f1156ab9c
5 changed files with 27 additions and 4 deletions

View File

@@ -90,9 +90,11 @@ export default class MigrationHandler extends BaseService {
// it the lock handler will break. So we create the directory now.
// Also if the sync target version is 0, it means it's a new one so we need the
// lock folder first before doing anything else.
// Temp folder is needed too to get remoteDate() call to work.
if (syncTargetInfo.version === 0 || syncTargetInfo.version === 1) {
this.logger().info('MigrationHandler: Sync target version is 0 or 1 - creating "locks" directory:', syncTargetInfo);
this.logger().info('MigrationHandler: Sync target version is 0 or 1 - creating "locks" and "temp" directory:', syncTargetInfo);
await this.api_.mkdir(Dirnames.Locks);
await this.api_.mkdir(Dirnames.Temp);
}
this.logger().info('MigrationHandler: Acquiring exclusive lock');

View File

@@ -305,6 +305,8 @@ class Synchronizer {
let syncLock = null;
try {
this.api().setTempDirName(Dirnames.Temp);
try {
const syncTargetInfo = await this.migrationHandler().checkCanSync();
@@ -321,8 +323,6 @@ class Synchronizer {
throw error;
}
this.api().setTempDirName(Dirnames.Temp);
syncLock = await this.lockHandler().acquireLock('sync', this.appType_, this.clientId_);
this.lockHandler().startAutoLockRefresh(syncLock, (error) => {