From 985ae05b30adf054b243c5f031f584d27a3d14ce Mon Sep 17 00:00:00 2001 From: Jamie V Date: Tue, 14 Apr 2026 13:12:59 -0700 Subject: [PATCH] changes from persistence fix 5.4.1 patch --- .../BaseMCWSPersistenceProvider.js | 22 ++++++++++++++----- src/services/mcws/MCWSClient.js | 3 --- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/persistence/BaseMCWSPersistenceProvider.js b/src/persistence/BaseMCWSPersistenceProvider.js index 09d9ce9..9661862 100644 --- a/src/persistence/BaseMCWSPersistenceProvider.js +++ b/src/persistence/BaseMCWSPersistenceProvider.js @@ -59,15 +59,25 @@ export default class BaseMCWSPersistenceProvider { * @returns {Promise.} persistenceNamespaces */ async getPersistenceNamespaces() { - // get root namespaces, get contained namespaces. - if (!this.persistenceNamespaces) { - const rootNamespaces = await this.getRootNamespaces(); - const allContainedNamespaces = await this.getAllContainedNamespaces(rootNamespaces); + // Return cached result if available + if (this.persistenceNamespaces) { + return this.persistenceNamespaces; + } + + // If initialization is in progress, wait for it + if (!this.persistenceNamespacesPromise) { + this.persistenceNamespacesPromise = (async () => { + const rootNamespaces = await this.getRootNamespaces(); + const allContainedNamespaces = await this.getAllContainedNamespaces(rootNamespaces); + + this.persistenceNamespaces = [...rootNamespaces, ...allContainedNamespaces]; + delete this.persistenceNamespacesPromise; - this.persistenceNamespaces = [...rootNamespaces, ...allContainedNamespaces]; + return this.persistenceNamespaces; + })(); } - return this.persistenceNamespaces; + return this.persistenceNamespacesPromise; } /** diff --git a/src/services/mcws/MCWSClient.js b/src/services/mcws/MCWSClient.js index 1354389..57fa427 100644 --- a/src/services/mcws/MCWSClient.js +++ b/src/services/mcws/MCWSClient.js @@ -60,9 +60,6 @@ class MCWSClient { delete options.params; } - // Keepalive - options.keepalive = true; - try { response = await fetch(url, options); } catch (error) {