Skip to content

Async plugin loading #54

@ylt

Description

@ylt

This is a hard one, allow plugins to initialize in parallel. Plugins such as plug can take a while to initialize (in the case of plug, the actual login process is done async, but this can cause issues for plugins which expect plug to be available upon starting).

Change the dependency system to manage this. While we could just patch it into the current dependency system, this is not optimal as it will just be a serial with parallelism just where dependencies happen to align. I'd like to make it so that plugin loading is initiated as soon as the minimal requirements for loading are met.

Probably will involve an extra list to store the loading state, one state will be for plugins waiting to be loaded (waiting for dependencies), another of plugins that are in the middle of loading.

This prevents accidentally loading a plugin twice, also it will allow for queuing up the plugins to start the loading of when the requirements have just been met.

Loading is probably easy enough, but there are several other cases to be handled: if a plugin has failed to start, what to do with dependencies that got loaded as a result, and how to handle the dependencies relying on it? If we try unloading dependencies it may unload plugins the user manually loaded earlier, so reasons should be implemented (manual vs automatic). In terms of dependent plugins, we can scan ahead on the load queue and cancel the ones ahead (maybe with similar load error logic as well, so that their dependencies are cleaned also).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions