diff --git a/platform/nodejs/index.js b/platform/nodejs/index.js index 08a65396d..e8c0171bb 100644 --- a/platform/nodejs/index.js +++ b/platform/nodejs/index.js @@ -146,6 +146,10 @@ function compileList({ name, raw }, compiler, writer, options = {}) { /******************************************************************************/ async function useLists(lists, options = {}) { + if ( useLists.promise !== null ) { + throw new Error('Pending useLists() operation'); + } + // Remove all filters snfe.reset(); @@ -174,13 +178,17 @@ async function useLists(lists, options = {}) { promises.push(promise.then(list => consumeList(list))); } - await Promise.all(promises); + useLists.promise = Promise.all(promises); + await useLists.promise; + useLists.promise = null; // Commit changes snfe.freeze(); snfe.optimize(); } +useLists.promise = null; + /******************************************************************************/ class MockStorage {