mirror of
https://github.com/Kong/insomnia.git
synced 2026-04-21 06:37:36 -04:00
fix: workspace create fails on windows (#9101)
* logs * add awaits to backup and block app start
This commit is contained in:
@@ -102,6 +102,8 @@ app.on('ready', async () => {
|
||||
// Init some important things first
|
||||
await database.init();
|
||||
await _createModelInstances();
|
||||
// backup needs the channel from settings which needs the database
|
||||
await backupIfNewerVersionAvailable();
|
||||
sentryWatchAnalyticsEnabled();
|
||||
watchProxySettings();
|
||||
windowUtils.init();
|
||||
@@ -321,7 +323,6 @@ async function _trackStats() {
|
||||
});
|
||||
|
||||
ipcMainOnce('halfSecondAfterAppStart', async () => {
|
||||
backupIfNewerVersionAvailable();
|
||||
const { currentVersion, launches, lastVersion } = stats;
|
||||
|
||||
const firstLaunch = launches === 1;
|
||||
|
||||
@@ -23,7 +23,7 @@ export async function backupIfNewerVersionAvailable() {
|
||||
);
|
||||
if (response) {
|
||||
console.log('[main] Found newer version');
|
||||
backup();
|
||||
await backup();
|
||||
return;
|
||||
}
|
||||
console.log('[main] No newer version');
|
||||
@@ -44,11 +44,12 @@ export async function backup() {
|
||||
return;
|
||||
}
|
||||
const files = await readdir(dataPath);
|
||||
files.forEach(async (file: string) => {
|
||||
for (const file of files) {
|
||||
if (file.endsWith('.db')) {
|
||||
await copyFile(path.join(dataPath, file), path.join(versionPath, file));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
console.log('[main] Exported backup to:', versionPath);
|
||||
} catch (err) {
|
||||
console.log('[main] Error exporting backup:', err);
|
||||
|
||||
@@ -178,8 +178,10 @@ export async function clientAction({ request, params }: Route.ClientActionArgs)
|
||||
})}/${scopeToActivity(workspace.scope)}`,
|
||||
);
|
||||
} catch (err) {
|
||||
console.error('Error creating workspace:', err);
|
||||
|
||||
return {
|
||||
error: `Failed to create workspace: ${err instanceof Error ? err.message : String(err)}`,
|
||||
error: `Failed to create workspace: ${err instanceof Error ? err.message : JSON.stringify(err)}`,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user