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:
parent
797f4a9669
commit
11646d1c21
@ -63,7 +63,7 @@ function useStyle() {
|
||||
|
||||
function useRestartOnDone(upgradeResult:SyncTargetUpgradeResult) {
|
||||
useEffect(function() {
|
||||
if (upgradeResult.done) {
|
||||
if (upgradeResult.done && !upgradeResult.error) {
|
||||
bridge().restart();
|
||||
}
|
||||
}, [upgradeResult.done]);
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user