fix(lib/plugins): only run dependencies that aren't already running
This commit is contained in:
parent
2b69e17d68
commit
3563daed39
1 changed files with 11 additions and 7 deletions
|
|
@ -329,19 +329,23 @@ export async function runPluginLate(plugin: AnyPlugin) {
|
|||
if (plugin.status & Status.Started)
|
||||
throw new Error(`Plugin "${plugin.manifest.id}" is already started`)
|
||||
|
||||
plugin.flags |= Flag.EnabledLate
|
||||
|
||||
// Reset previous computations
|
||||
pListOrdered.length = 0
|
||||
pPending.add(plugin)
|
||||
computePendingNodes()
|
||||
|
||||
await Promise.all(
|
||||
pListOrdered.map(async function runLate(plugin) {
|
||||
await preInitPlugin(plugin)
|
||||
await initPlugin(plugin)
|
||||
await startPlugin(plugin)
|
||||
}),
|
||||
// If the plugin is stopped, we should initialize it
|
||||
pListOrdered
|
||||
.filter(plugin => !plugin.status)
|
||||
.map(async function runLate(plugin) {
|
||||
plugin.flags |= Flag.EnabledLate
|
||||
|
||||
// Prepare the plugin API
|
||||
await preInitPlugin(plugin)
|
||||
await initPlugin(plugin)
|
||||
await startPlugin(plugin)
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue