From bebc0db7d8919cfc8fcec80089792c62483b8425 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Tue, 22 Sep 2026 07:32:35 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20"fix(web):=20retry=20importScripts=20N?= =?UTF-8?q?etworkErrors=20in=20attempt=20to=20mitigate=20errors=20loading?= =?UTF-8?q?=20models=20=F0=9F=8F=A0"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../worker-thread/src/main/index.ts | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/web/src/engine/predictive-text/worker-thread/src/main/index.ts b/web/src/engine/predictive-text/worker-thread/src/main/index.ts index 684f7390ae4..952fbbf6185 100644 --- a/web/src/engine/predictive-text/worker-thread/src/main/index.ts +++ b/web/src/engine/predictive-text/worker-thread/src/main/index.ts @@ -242,7 +242,7 @@ export default class LMLayerWorker { } } - private loadModelFile(url: string, tryCount: number = 0) { + private loadModelFile(url: string) { // The self/global WebWorker method, allowing us to directly import another script file into WebWorker scope. // If built correctly, the model's script file will auto-register the model with loadModel() above. try { @@ -250,19 +250,8 @@ export default class LMLayerWorker { } catch (err) { // Does not catch errors thrown within the imported script. // Does catch errors with the model script's file-path. - // #13862: attempt to mitigate NetworkError on Chrome by retrying before giving up - tryCount++; - if(err instanceof Error && err.name == 'NetworkError') { - if(tryCount < 4) { - // increase delay with each retry: 10msec, 100msec, 1000msec - console?.warn(`NetworkError when attempting to load dictionary (attempt ${tryCount} of 4, will retry after ${10 ** tryCount} msec): ${err.toString()}`); - setTimeout(() => this.loadModelFile(url, tryCount), 10 ** tryCount); - } else { - this.error(`NetworkError when attempting to load dictionary (attempt ${tryCount} of 4, giving up): ${err.toString()}`); - } - } else { - this.error("Error occurred when attempting to load dictionary", err); - } + this.error("Error occurred when attempting to load dictionary", err); + // Remain in the model-unloaded state; the load attempt was unsuccessful. } }