File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,15 +59,25 @@ export default class BaseMCWSPersistenceProvider {
5959 * @returns {Promise.<NamespaceDefinition[]> } persistenceNamespaces
6060 */
6161 async getPersistenceNamespaces ( ) {
62- // get root namespaces, get contained namespaces.
63- if ( ! this . persistenceNamespaces ) {
64- const rootNamespaces = await this . getRootNamespaces ( ) ;
65- const allContainedNamespaces = await this . getAllContainedNamespaces ( rootNamespaces ) ;
62+ // Return cached result if available
63+ if ( this . persistenceNamespaces ) {
64+ return this . persistenceNamespaces ;
65+ }
66+
67+ // If initialization is in progress, wait for it
68+ if ( ! this . persistenceNamespacesPromise ) {
69+ this . persistenceNamespacesPromise = ( async ( ) => {
70+ const rootNamespaces = await this . getRootNamespaces ( ) ;
71+ const allContainedNamespaces = await this . getAllContainedNamespaces ( rootNamespaces ) ;
72+
73+ this . persistenceNamespaces = [ ...rootNamespaces , ...allContainedNamespaces ] ;
74+ delete this . persistenceNamespacesPromise ;
6675
67- this . persistenceNamespaces = [ ...rootNamespaces , ...allContainedNamespaces ] ;
76+ return this . persistenceNamespaces ;
77+ } ) ( ) ;
6878 }
6979
70- return this . persistenceNamespaces ;
80+ return this . persistenceNamespacesPromise ;
7181 }
7282
7383 /**
Original file line number Diff line number Diff line change @@ -60,9 +60,6 @@ class MCWSClient {
6060 delete options . params ;
6161 }
6262
63- // Keepalive
64- options . keepalive = true ;
65-
6663 try {
6764 response = await fetch ( url , options ) ;
6865 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments