fix server restart

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-04-03 08:22:43 -04:00
parent 6c29c3fb4d
commit 5bdc87b68a
9 changed files with 25 additions and 12 deletions
+8 -1
View File
@@ -3,6 +3,7 @@ window.api = '/sdapi/v1';
window.subpath = '';
async function initStartup() {
const t0 = performance.now();
log('initStartup');
if (window.setupLogger) await setupLogger();
@@ -24,7 +25,11 @@ async function initStartup() {
await reconnectUI();
// make sure all of the ui is ready and options are loaded
while (Object.keys(window.opts).length === 0) await sleep(50);
let t1 = performance.now();
while ((Object.keys(window.opts).length === 0) && (t1 - t0 < 10000)) {
t1 = performance.now();
await sleep(50);
}
log('mountURL', window.opts.subpath);
if (window.opts.subpath?.length > 0) {
window.subpath = window.opts.subpath;
@@ -43,6 +48,8 @@ async function initStartup() {
setHints();
applyStyles();
initIndexDB();
t1 = performance.now();
log('initStartup', Math.round(1000 * (t1 - t0) / 1000000));
}
onUiLoaded(initStartup);