From b59e2f1813f074a55821be793233715e10c80f48 Mon Sep 17 00:00:00 2001 From: Alex Menor Date: Mon, 3 Jan 2022 11:10:50 +0100 Subject: [PATCH 01/10] dont clear file logger until a next sync starts --- src/renderer/components/SyncInfo/SyncInfo.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/SyncInfo/SyncInfo.vue b/src/renderer/components/SyncInfo/SyncInfo.vue index d80a0ef85..9aa4b2dc4 100644 --- a/src/renderer/components/SyncInfo/SyncInfo.vue +++ b/src/renderer/components/SyncInfo/SyncInfo.vue @@ -63,6 +63,7 @@ import path from 'path' import FileIconWithOperation from '../Icons/FileIconWithOperation.vue' import { shortMessages } from '../../../sync/sync-error-messages' import { ipcRenderer } from 'electron' +import syncStatus from '../../../sync/sync-status' const app = require('@electron/remote').app export default { @@ -79,11 +80,11 @@ export default { }, mounted() { app.on('SYNC_INFO_UPDATE', this.onInfoUpdate) - app.on('SYNC_NEXT', this.onNext) + app.on('sync-status-changed', this.onSyncStatusChanged) }, beforeDestroy() { app.removeListener('SYNC_INFO_UPDATE', this.onInfoUpdate) - app.removeListener('SYNC_NEXT', this.onNext) + app.removeListener('sync-status-changed', this.onSyncStatusChanged) }, methods: { onInfoUpdate(item) { @@ -113,8 +114,8 @@ export default { this.items = itemsCopy } }, - onNext() { - this.items = [] + onSyncStatusChanged(newStatus) { + if (newStatus === syncStatus.RUNNING) this.items = [] }, clear() {}, getStatusMessage(item) { From c28919baf52d9484f2620ca29070b17706ea86bd Mon Sep 17 00:00:00 2001 From: Alex Menor Date: Mon, 3 Jan 2022 11:15:16 +0100 Subject: [PATCH 02/10] fix updated just now being cleared by a previous sync --- src/renderer/components/SyncBottom/SyncBottom.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/SyncBottom/SyncBottom.vue b/src/renderer/components/SyncBottom/SyncBottom.vue index 34cd05f33..eb0760f9a 100644 --- a/src/renderer/components/SyncBottom/SyncBottom.vue +++ b/src/renderer/components/SyncBottom/SyncBottom.vue @@ -79,7 +79,10 @@ export default { } if (this.showUpdatedJustNow) { - setTimeout(() => (this.showUpdatedJustNow = false), 30 * 1000) + this.showUpdatedJustNowTimeout = setTimeout( + () => (this.showUpdatedJustNow = false), + 30 * 1000 + ) } }, onStartClick() { From e6744d394601f7892d79e319018a90a9c7bf8999 Mon Sep 17 00:00:00 2001 From: Alex Menor Date: Mon, 3 Jan 2022 11:26:01 +0100 Subject: [PATCH 03/10] fix overflow of file names --- src/renderer/components/SyncInfo/SyncInfo.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/components/SyncInfo/SyncInfo.vue b/src/renderer/components/SyncInfo/SyncInfo.vue index 9aa4b2dc4..dc718d2b6 100644 --- a/src/renderer/components/SyncInfo/SyncInfo.vue +++ b/src/renderer/components/SyncInfo/SyncInfo.vue @@ -20,7 +20,7 @@ size="32" class="flex-shrink-0 flex-grow-0" /> -
+

{{ item.name | showOnlyFilename }}

From c4509fc36a78cbe0b9fbee20af203cb7d252b491 Mon Sep 17 00:00:00 2001 From: Alex Menor Date: Tue, 4 Jan 2022 12:03:23 +0100 Subject: [PATCH 04/10] stop using compresion in backups to reduce cpu usage --- src/backup-process/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backup-process/index.js b/src/backup-process/index.js index 08346b291..8fb710429 100644 --- a/src/backup-process/index.js +++ b/src/backup-process/index.js @@ -136,7 +136,7 @@ function checkThatItExists(path) { } function getZipStream(backupPath) { - const archive = archiver('zip', { zlib: { level: 9 } }) + const archive = archiver('zip', { store: true }) archive.directory(backupPath, false) @@ -147,7 +147,7 @@ function getZipStream(backupPath) { function zipAndHash(backupPath, fileEncryptionKey, index) { return new Promise((resolve, reject) => { - const archive = archiver('zip', { zlib: { level: 9 } }) + const archive = archiver('zip', { store: true }) archive.directory(backupPath, false) @@ -161,7 +161,7 @@ function zipAndHash(backupPath, fileEncryptionKey, index) { const encryptedHasher = new Environment.utils.Hasher() - pipeline(archive, hasher, cypher, encryptedHasher, console.log) + pipeline(archive, hasher, cypher, encryptedHasher, () => undefined) .on('data', () => {}) .on('end', () => { const plainHash = hasher.getHash().toString('hex') From ef3e6625a771fe2158428f8bd6c6045ba3e42eb9 Mon Sep 17 00:00:00 2001 From: Alex Menor Date: Tue, 4 Jan 2022 12:34:17 +0100 Subject: [PATCH 05/10] limit the level of verbosity in prod to reduce disk writes --- src/libs/logger.js | 8 ++++++++ src/sync/sync.ts | 40 ++++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/libs/logger.js b/src/libs/logger.js index 9bce1b5cf..5b3e215e7 100644 --- a/src/libs/logger.js +++ b/src/libs/logger.js @@ -5,6 +5,14 @@ let Logger = console log.transports.file.maxSize = 1048576 * 150 // 150MB log.transports.console.format = '[{iso}] [{level}] {text}' +if (process.env.NODE_ENV !== 'development') { + log.transports.file.level = 'info' + log.transports.console.level = 'error' +} else { + log.transports.file.level = 'silly' + log.transports.console.level = 'silly' +} + Logger = log export default Logger diff --git a/src/sync/sync.ts b/src/sync/sync.ts index 49d552b99..5dd03752b 100644 --- a/src/sync/sync.ts +++ b/src/sync/sync.ts @@ -23,7 +23,7 @@ class Sync extends EventEmitter { this.emit('CHECKING_LAST_RUN_OUTCOME') const lastSavedListing = await this.listingStore.getLastSavedListing() - Logger.log('Last saved listing:', lastSavedListing) + Logger.debug('Last saved listing:', lastSavedListing) if (!lastSavedListing) return this.resync() @@ -33,14 +33,14 @@ class Sync extends EventEmitter { emitErrors: true }) - Logger.log('Current local before', currentLocal) - Logger.log('Current remote before', currentRemote) + Logger.debug('Current local before', currentLocal) + Logger.debug('Current remote before', currentRemote) const deltasLocal = this.generateDeltas(lastSavedListing, currentLocal) const deltasRemote = this.generateDeltas(lastSavedListing, currentRemote) - Logger.log('Local deltas', deltasLocal) - Logger.log('Remote deltas', deltasRemote) + Logger.debug('Local deltas', deltasLocal) + Logger.debug('Remote deltas', deltasRemote) const { renameInLocal, @@ -58,12 +58,12 @@ class Sync extends EventEmitter { await this.listingStore.removeSavedListing() - Logger.log('Queue rename in local', renameInLocal) - Logger.log('Queue rename in remote', renameInRemote) - Logger.log('Queue pull from local', pullFromLocal) - Logger.log('Queue pull from remote', pullFromRemote) - Logger.log('Queue delete from local', deleteInLocal) - Logger.log('Queue delete from remote', deleteInRemote) + Logger.debug('Queue rename in local', renameInLocal) + Logger.debug('Queue rename in remote', renameInRemote) + Logger.debug('Queue pull from local', pullFromLocal) + Logger.debug('Queue pull from remote', pullFromRemote) + Logger.debug('Queue delete from local', deleteInLocal) + Logger.debug('Queue delete from remote', deleteInRemote) await Promise.all([ this.consumeRenameQueue(renameInLocal, this.local), @@ -101,8 +101,8 @@ class Sync extends EventEmitter { emitErrors: true }) - Logger.log('Current local before', currentLocal) - Logger.log('Current remote before', currentRemote) + Logger.debug('Current local before', currentLocal) + Logger.debug('Current remote before', currentRemote) const { filesNotInLocal: pullFromLocal, @@ -124,10 +124,10 @@ class Sync extends EventEmitter { pullFromRemote.push(localRenamed) } - Logger.log('Queue rename in local', renameInLocal) - Logger.log('Queue rename in remote', renameInRemote) - Logger.log('Queue pull from local', pullFromLocal) - Logger.log('Queue pull from remote', pullFromRemote) + Logger.debug('Queue rename in local', renameInLocal) + Logger.debug('Queue rename in remote', renameInRemote) + Logger.debug('Queue pull from local', pullFromLocal) + Logger.debug('Queue pull from remote', pullFromRemote) await Promise.all([ this.consumeRenameQueue(renameInLocal, this.local), @@ -470,14 +470,14 @@ class Sync extends EventEmitter { if (_.isEqual(currentLocal, currentRemote)) { const currentInBoth = currentLocal - Logger.log('Current in both:', currentInBoth) + Logger.debug('Current in both:', currentInBoth) await this.listingStore.saveListing(currentInBoth) this.emit('DONE', { status: 'IN_SYNC' }) } else { - Logger.log('Current local:', currentLocal) - Logger.log('Current remote:', currentRemote) + Logger.debug('Current local:', currentLocal) + Logger.debug('Current remote:', currentRemote) const diff = this.getListingsDiff(currentLocal, currentRemote) this.emit('DONE', { status: 'NOT_IN_SYNC', diff }) From ae9364d14ceb4519a5089011a5cc610512cd6994 Mon Sep 17 00:00:00 2001 From: Alex Menor Date: Tue, 4 Jan 2022 13:16:39 +0100 Subject: [PATCH 06/10] avoid running backup and sync process at the same time when launching automatically --- src/main/index.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index d1d45b94c..10e2d6650 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -639,7 +639,17 @@ function startBackgroundProcesses() { let backupProcessStatus = BackupStatus.STANDBY let backupProcessRerun = null -async function startBackupProcess() { +function waitForSyncToFinish() { + if (syncStatus === SyncStatus.STANDBY) return Promise.resolve() + + return new Promise(resolve => { + app.once('sync-status-changed', resolve) + }) +} + +async function startBackupProcess({ avoidRunningWithSync = true }) { + if (avoidRunningWithSync) await waitForSyncToFinish() + const backupsAreEnabled = ConfigStore.get('backupsEnabled') if (backupsAreEnabled && backupProcessStatus !== BackupStatus.IN_PROGRESS) { @@ -714,7 +724,9 @@ async function startBackupProcess() { } } -ipcMain.on('start-backup-process', startBackupProcess) +ipcMain.on('start-backup-process', () => + startBackupProcess({ avoidRunningWithSync: false }) +) ipcMain.handle('get-backup-status', () => backupProcessStatus) @@ -763,7 +775,7 @@ function notifyBackupProcessWithNoConnection() { notification.show() notification.on('click', () => { - startBackupProcess() + startBackupProcess({ avoidRunningWithSync: false }) }) } From a2e993373e7d9e904233b810303c423ee70c97f2 Mon Sep 17 00:00:00 2001 From: Alex Menor Date: Fri, 7 Jan 2022 10:28:58 +0100 Subject: [PATCH 07/10] prioritize sync process --- src/main/index.js | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index 10e2d6650..30dfbefcd 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -593,6 +593,22 @@ app.on('logged-in', startBackgroundProcesses) function startBackgroundProcesses() { checkUpdates() + // Check if we should launch sync process + + const lastSync = ConfigStore.get('lastSync') + + if (lastSync !== -1) { + const currentTimestamp = new Date().valueOf() + + const millisecondsToNextSync = lastSync + SYNC_INTERVAL - currentTimestamp + + if (millisecondsToNextSync <= 0) { + startSyncProcess() + } else { + syncProcessRerun = setTimeout(startSyncProcess, millisecondsToNextSync) + } + } + // Check if we should launch backup process const backupInterval = ConfigStore.get('backupInterval') @@ -614,22 +630,6 @@ function startBackgroundProcesses() { } } - // Check if we should launch sync process - - const lastSync = ConfigStore.get('lastSync') - - if (lastSync !== -1) { - const currentTimestamp = new Date().valueOf() - - const millisecondsToNextSync = lastSync + SYNC_INTERVAL - currentTimestamp - - if (millisecondsToNextSync <= 0) { - startSyncProcess() - } else { - syncProcessRerun = setTimeout(startSyncProcess, millisecondsToNextSync) - } - } - // Check updates every 6 hours setInterval(() => { checkUpdates() @@ -647,7 +647,7 @@ function waitForSyncToFinish() { }) } -async function startBackupProcess({ avoidRunningWithSync = true }) { +async function startBackupProcess(avoidRunningWithSync = true) { if (avoidRunningWithSync) await waitForSyncToFinish() const backupsAreEnabled = ConfigStore.get('backupsEnabled') @@ -724,9 +724,7 @@ async function startBackupProcess({ avoidRunningWithSync = true }) { } } -ipcMain.on('start-backup-process', () => - startBackupProcess({ avoidRunningWithSync: false }) -) +ipcMain.on('start-backup-process', () => startBackupProcess(false)) ipcMain.handle('get-backup-status', () => backupProcessStatus) @@ -775,7 +773,7 @@ function notifyBackupProcessWithNoConnection() { notification.show() notification.on('click', () => { - startBackupProcess({ avoidRunningWithSync: false }) + startBackupProcess(false) }) } From 82c2bcaa13652d469c22ee38da76850f8936dfb4 Mon Sep 17 00:00:00 2001 From: Alex Menor Date: Fri, 7 Jan 2022 10:33:14 +0100 Subject: [PATCH 08/10] update sync policy when conflicts happen --- src/sync/sync.ts | 43 ++++-------- src/sync/test/sync.test.ts | 135 ++++++------------------------------- 2 files changed, 35 insertions(+), 143 deletions(-) diff --git a/src/sync/sync.ts b/src/sync/sync.ts index 5dd03752b..024182a8b 100644 --- a/src/sync/sync.ts +++ b/src/sync/sync.ts @@ -110,29 +110,17 @@ class Sync extends EventEmitter { filesWithDifferentModtime } = this.getListingsDiff(currentLocal, currentRemote) - const renameInLocal: [string, string][] = [] - const renameInRemote: [string, string][] = [] - for (const name of filesWithDifferentModtime) { - const localRenamed = this.rename(name, 'local') - const remoteRenamed = this.rename(name, 'remote') - - renameInLocal.push([name, localRenamed]) - renameInRemote.push([name, remoteRenamed]) + const modtimeInLocal = currentLocal[name] + const modtimeInRemote = currentRemote[name] - pullFromLocal.push(remoteRenamed) - pullFromRemote.push(localRenamed) + if (modtimeInLocal < modtimeInRemote) pullFromLocal.push(name) + else pullFromRemote.push(name) } - Logger.debug('Queue rename in local', renameInLocal) - Logger.debug('Queue rename in remote', renameInRemote) Logger.debug('Queue pull from local', pullFromLocal) Logger.debug('Queue pull from remote', pullFromRemote) - await Promise.all([ - this.consumeRenameQueue(renameInLocal, this.local), - this.consumeRenameQueue(renameInRemote, this.remote) - ]) await Promise.all([ this.consumePullQueue(pullFromLocal, this.local, this.remote), this.consumePullQueue(pullFromRemote, this.remote, this.local) @@ -161,15 +149,12 @@ class Sync extends EventEmitter { const deleteInLocal: string[] = [] const deleteInRemote: string[] = [] - const renameAndKeepBoth = (name: string) => { - const localRenamed = this.rename(name, 'local') - const remoteRenamed = this.rename(name, 'remote') + const keepMostRecent = (name: string) => { + const modtimeInLocal = currentLocalListing[name] + const modtimeInRemote = currentRemoteListing[name] - renameInLocal.push([name, localRenamed]) - renameInRemote.push([name, remoteRenamed]) - - pullFromLocal.push(remoteRenamed) - pullFromRemote.push(localRenamed) + if (modtimeInLocal < modtimeInRemote) pullFromLocal.push(name) + else pullFromRemote.push(name) } for (const [name, deltaLocal] of Object.entries(deltasLocal)) { @@ -179,7 +164,7 @@ class Sync extends EventEmitter { currentLocalListing[name] === currentRemoteListing[name] if (deltaLocal === 'NEW' && deltaRemote === 'NEW' && !sameModTime) { - renameAndKeepBoth(name) + keepMostRecent(name) } if (deltaLocal === 'NEW' && doesntExistInRemote) { @@ -187,7 +172,7 @@ class Sync extends EventEmitter { } if (deltaLocal === 'NEWER' && deltaRemote === 'NEWER' && !sameModTime) { - renameAndKeepBoth(name) + keepMostRecent(name) } if ( @@ -198,7 +183,7 @@ class Sync extends EventEmitter { } if (deltaLocal === 'NEWER' && deltaRemote === 'OLDER') { - renameAndKeepBoth(name) + pullFromRemote.push(name) } if ( @@ -213,7 +198,7 @@ class Sync extends EventEmitter { } if (deltaLocal === 'OLDER' && deltaRemote === 'NEWER') { - renameAndKeepBoth(name) + pullFromLocal.push(name) } if ( @@ -224,7 +209,7 @@ class Sync extends EventEmitter { } if (deltaLocal === 'OLDER' && deltaRemote === 'OLDER' && !sameModTime) { - renameAndKeepBoth(name) + keepMostRecent(name) } if ( diff --git a/src/sync/test/sync.test.ts b/src/sync/test/sync.test.ts index ea07eafdc..ca4e122f7 100644 --- a/src/sync/test/sync.test.ts +++ b/src/sync/test/sync.test.ts @@ -151,53 +151,38 @@ describe('sync tests', () => { } = setupEventSpies(sync) const spyRemotePull = jest.spyOn(remote, 'pullFile') - const spyRemoteRename = jest.spyOn(remote, 'renameFile') const spyLocalPull = jest.spyOn(local, 'pullFile') - const spyLocalRename = jest.spyOn(local, 'renameFile') await sync.run() - expect(spyRemoteRename).toBeCalledWith( - 'folder/nested/existInBoth.txt', - 'folder/nested/existInBoth_remote.txt' - ) expect(spyRemotePull).toHaveBeenCalledWith( 'notExistInRemote', expect.anything(), expect.anything() ) - expect(spyRemotePull).toHaveBeenCalledWith( - 'folder/nested/existInBoth_local.txt', + expect(spyLocalPull).toHaveBeenCalledWith( + 'folder/nested/existInBoth.txt', expect.anything(), expect.anything() ) - expect(spyLocalRename).toBeCalledWith( - 'folder/nested/existInBoth.txt', - 'folder/nested/existInBoth_local.txt' - ) expect(spyLocalPull).toHaveBeenCalledWith( 'notExistInLocal', expect.anything(), expect.anything() ) - expect(spyLocalPull).toHaveBeenCalledWith( - 'folder/nested/existInBoth_remote.txt', - expect.anything(), - expect.anything() - ) expect(smokeTestingCB).toBeCalledTimes(1) expect(checkingLastRunCB).toBeCalledTimes(1) expect(needResyncCB).toBeCalledTimes(1) expect(generatingActionsCB).toBeCalledTimes(0) - expect(pullingFileCB).toBeCalledTimes(4) - expect(pulledFileCB).toBeCalledTimes(4) + expect(pullingFileCB).toBeCalledTimes(3) + expect(pulledFileCB).toBeCalledTimes(3) expect(deletingFileCB).toBeCalledTimes(0) expect(deletedFileCB).toBeCalledTimes(0) - expect(renamingFileCB).toBeCalledTimes(2) - expect(renamedFileCB).toBeCalledTimes(2) + expect(renamingFileCB).toBeCalledTimes(0) + expect(renamedFileCB).toBeCalledTimes(0) expect(finalizingCB).toBeCalledTimes(1) expect(doneCB).toBeCalledTimes(1) }) @@ -236,7 +221,7 @@ describe('sync tests', () => { 'new/new/different': 4, 'new/new/same': 4, 'new/noexist': 43, - 'newer/newer/different': 5, + 'newer/newer/different': 6, 'newer/newer/same': 5, 'newer/deleted': 6, 'newer/older': 6, @@ -263,7 +248,7 @@ describe('sync tests', () => { listing: { 'new/new/different': 5, 'new/new/same': 4, - 'newer/newer/different': 6, + 'newer/newer/different': 5, 'newer/newer/same': 5, 'newer/older': 4, 'newer/unchanged': 4, @@ -297,46 +282,37 @@ describe('sync tests', () => { deletedFileCB, deletingFolderCB, deletedFolderCB, - renamingFileCB, - renamedFileCB, finalizingCB, doneCB } = setupEventSpies(sync) const spyRemotePull = jest.spyOn(remote, 'pullFile') - const spyRemoteRename = jest.spyOn(remote, 'renameFile') const spyRemoteDelete = jest.spyOn(remote, 'deleteFile') const spyRemoteDeleteFolder = jest.spyOn(remote, 'deleteFolder') const spyLocalPull = jest.spyOn(local, 'pullFile') - const spyLocalRename = jest.spyOn(local, 'renameFile') const spyLocalDelete = jest.spyOn(local, 'deleteFile') const spyLocalDeleteFolder = jest.spyOn(local, 'deleteFolder') await sync.run() const expectPullRemote = [ - 'new/new/different_local', 'new/noexist', - 'newer/newer/different_local', 'newer/deleted', 'newer/unchanged', - 'newer/older_local', + 'newer/older', 'older/deleted', - 'older/newer_local', - 'older/older/different_local', + 'older/older/different', + 'newer/newer/different', 'older/unchanged' ] const expectPullLocal = [ - 'new/new/different_remote', + 'new/new/different', 'noexist/new', - 'newer/newer/different_remote', 'deleted/newer', - 'newer/older_remote', + 'older/newer', 'unchanged/newer', - 'older/newer_remote', 'deleted/older', - 'older/older/different_remote', 'unchanged/older' ] const notExpectPullRemote = [ @@ -382,28 +358,6 @@ describe('sync tests', () => { ) ) - const expectRenameRemote = [ - ['new/new/different', 'new/new/different_remote'], - ['newer/newer/different', 'newer/newer/different_remote'], - ['older/older/different', 'older/older/different_remote'], - ['newer/older', 'newer/older_remote'], - ['older/newer', 'older/newer_remote'] - ] - const expectRenameLocal = [ - ['new/new/different', 'new/new/different_local'], - ['newer/newer/different', 'newer/newer/different_local'], - ['older/older/different', 'older/older/different_local'], - ['newer/older', 'newer/older_local'], - ['newer/older', 'newer/older_local'] - ] - - expectRenameLocal.forEach(args => - expect(spyLocalRename).toBeCalledWith(...args) - ) - expectRenameRemote.forEach(args => - expect(spyRemoteRename).toBeCalledWith(...args) - ) - expect(spyLocalDelete).not.toBeCalledWith('deleted/deleted') expect(spyRemoteDelete).not.toBeCalledWith('deleted/deleted') @@ -428,10 +382,6 @@ describe('sync tests', () => { expect(deletingFolderCB).toBeCalledTimes(1) expect(deletedFolderCB).toBeCalledTimes(1) - const expectedRenames = expectRenameLocal.length + expectRenameRemote.length - expect(renamingFileCB).toBeCalledTimes(expectedRenames) - expect(renamedFileCB).toBeCalledTimes(expectedRenames) - expect(finalizingCB).toBeCalledTimes(1) expect(doneCB).toBeCalledTimes(1) }) @@ -502,7 +452,7 @@ describe('sync tests', () => { aa: 2, b: 2, - c: 2, + c: 1, cc: 2, d: 2, e: 2, @@ -510,7 +460,7 @@ describe('sync tests', () => { k: 2, m: 2, - n: 2, + n: 1, nn: 2, l: 2, @@ -525,9 +475,9 @@ describe('sync tests', () => { aa: 2, b: 2, - c: 1, + c: 2, cc: 2, - e: 2, + e: 1, f: 2, g: 2, @@ -535,8 +485,8 @@ describe('sync tests', () => { i: 2, j: 2, - k: 2, - n: 1, + k: 3, + n: 2, nn: 2, l: 2, @@ -604,8 +554,6 @@ describe('sync tests', () => { const { pullFromLocal, pullFromRemote, - renameInLocal, - renameInRemote, deleteInLocal, deleteInRemote } = sync['generateActionQueues']( @@ -616,51 +564,10 @@ describe('sync tests', () => { ) expect(pullFromLocal.sort()).toEqual( - [ - 'a_remote', - 'c_remote', - 'e_remote', - 'g', - 'i', - 'k_remote', - 'n_remote', - 'o', - 'q', - 's' - ].sort() + ['c', 'g', 'i', 'n', 'k', 'o', 'q', 's'].sort() ) expect(pullFromRemote.sort()).toEqual( - [ - 'a_local', - 'c_local', - 'e_local', - 'k_local', - 'n_local', - 'b', - 'd', - 'f', - 'm', - 'l' - ].sort() - ) - - expect(renameInLocal.sort()).toEqual( - [ - ['a', 'a_local'], - ['c', 'c_local'], - ['e', 'e_local'], - ['k', 'k_local'], - ['n', 'n_local'] - ].sort() - ) - expect(renameInRemote.sort()).toEqual( - [ - ['a', 'a_remote'], - ['c', 'c_remote'], - ['e', 'e_remote'], - ['k', 'k_remote'], - ['n', 'n_remote'] - ].sort() + ['a', 'b', 'e', 'd', 'f', 'm', 'l'].sort() ) expect(deleteInLocal).toEqual(['p']) From 491020d1a9e49c2aba9a2e4975817b4dbb95301e Mon Sep 17 00:00:00 2001 From: Alex Menor Date: Fri, 7 Jan 2022 10:37:34 +0100 Subject: [PATCH 09/10] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 070cc9019..d6d34ec6e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "internxt-drive", - "version": "1.5.0", + "version": "1.5.1", "author": "Internxt ", "description": "Internxt Drive client UI", "license": "AGPL-3.0", From c870ba60b88115a968e697fa117fa2dcc9af4537 Mon Sep 17 00:00:00 2001 From: Alex Menor Date: Fri, 7 Jan 2022 15:35:00 +0100 Subject: [PATCH 10/10] dont show 'in progress' items in file logger component if the sync process is stopped --- src/renderer/components/SyncInfo/SyncInfo.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/renderer/components/SyncInfo/SyncInfo.vue b/src/renderer/components/SyncInfo/SyncInfo.vue index dc718d2b6..06264e37c 100644 --- a/src/renderer/components/SyncInfo/SyncInfo.vue +++ b/src/renderer/components/SyncInfo/SyncInfo.vue @@ -81,10 +81,12 @@ export default { mounted() { app.on('SYNC_INFO_UPDATE', this.onInfoUpdate) app.on('sync-status-changed', this.onSyncStatusChanged) + app.on('SYNC_NEXT', this.onNext) }, beforeDestroy() { app.removeListener('SYNC_INFO_UPDATE', this.onInfoUpdate) app.removeListener('sync-status-changed', this.onSyncStatusChanged) + app.removeListener('SYNC_NEXT', this.onNext) }, methods: { onInfoUpdate(item) { @@ -117,6 +119,9 @@ export default { onSyncStatusChanged(newStatus) { if (newStatus === syncStatus.RUNNING) this.items = [] }, + onNext() { + this.items = this.items.filter(item => item.progress === undefined) + }, clear() {}, getStatusMessage(item) { if (item.action === 'PULL' && item.kind === 'REMOTE') {