1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Desktop: Added more logging info to sync target upgrade process

This commit is contained in:
Laurent Cozic 2020-08-29 19:12:02 +01:00
parent 797f4a9669
commit 11646d1c21
2 changed files with 8 additions and 1 deletions

View File

@ -63,7 +63,7 @@ function useStyle() {
function useRestartOnDone(upgradeResult:SyncTargetUpgradeResult) {
useEffect(function() {
if (upgradeResult.done) {
if (upgradeResult.done && !upgradeResult.error) {
bridge().restart();
}
}, [upgradeResult.done]);

View File

@ -15,10 +15,14 @@ export default function useSyncTargetUpgrade():SyncTargetUpgradeResult {
});
async function upgradeSyncTarget() {
reg.logger().info('useSyncTargetUpgrade: Starting process...');
let error = null;
try {
reg.logger().info('useSyncTargetUpgrade: Acquire synchronizer...');
const synchronizer = await reg.syncTarget().synchronizer();
reg.logger().info('useSyncTargetUpgrade: Create migration handler...');
const migrationHandler = new MigrationHandler(
synchronizer.api(),
synchronizer.lockHandler(),
@ -26,11 +30,14 @@ export default function useSyncTargetUpgrade():SyncTargetUpgradeResult {
Setting.value('clientId')
);
reg.logger().info('useSyncTargetUpgrade: Start upgrade...');
await migrationHandler.upgrade();
} catch (e) {
error = e;
}
reg.logger().info('useSyncTargetUpgrade: Error:', error);
if (!error) {
Setting.setValue('sync.upgradeState', Setting.SYNC_UPGRADE_STATE_IDLE);
await Setting.saveAll();