diff --git a/misc/admin/lib/geturl.js b/misc/admin/lib/geturl.js index e890259a9..fb4b3ab95 100644 --- a/misc/admin/lib/geturl.js +++ b/misc/admin/lib/geturl.js @@ -61,10 +61,12 @@ function nonnull(value) { } return value; } -function staller(duration) { +function staller(duration, block) { return new Promise((resolve) => { const timer = setTimeout(resolve, duration); - timer.unref(); + if (!block) { + timer.unref(); + } }); } function _getUrl(href, options) { @@ -121,7 +123,7 @@ function getUrl(href, options) { catch (e) { error = e; } - yield staller(1000); + yield staller(1000, true); } throw error; }); diff --git a/misc/admin/src.ts/geturl.ts b/misc/admin/src.ts/geturl.ts index dbeed171e..9f8d52fc6 100644 --- a/misc/admin/src.ts/geturl.ts +++ b/misc/admin/src.ts/geturl.ts @@ -68,10 +68,10 @@ function nonnull(value: string): string { return value; } -function staller(duration: number): Promise { +function staller(duration: number, block?: boolean): Promise { return new Promise((resolve) => { const timer = setTimeout(resolve, duration); - timer.unref(); + if (!block) { timer.unref(); } }); } @@ -131,7 +131,7 @@ export async function getUrl(href: string, options?: Options): Promise