1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #4180 from node-red/4168-make-module-install-synchronous

Ensure external modules are installed synchronously
This commit is contained in:
Nick O'Leary 2023-05-22 14:39:26 +01:00 committed by GitHub
commit b904c23e4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -242,7 +242,9 @@ async function ensureModuleDir() {
} }
} }
let installLock = Promise.resolve()
async function installModule(moduleDetails) { async function installModule(moduleDetails) {
const result = installLock.then(async () => {
let installSpec = moduleDetails.module; let installSpec = moduleDetails.module;
if (!registryUtil.checkModuleAllowed( moduleDetails.module, moduleDetails.version,installAllowList,installDenyList)) { if (!registryUtil.checkModuleAllowed( moduleDetails.module, moduleDetails.version,installAllowList,installDenyList)) {
const e = new Error("Install not allowed"); const e = new Error("Install not allowed");
@ -299,6 +301,9 @@ async function installModule(moduleDetails) {
throw e; throw e;
} }
}) })
})
installLock = result.catch(() => {})
return result
} }
module.exports = { module.exports = {