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:
commit
b904c23e4d
@ -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 = {
|
||||||
|
Loading…
Reference in New Issue
Block a user