Skip to content

gs-plugin-loader: Don't start all plugins in parallel

Phaedrus Leeds requested to merge mwleeds/fix-setup-async-parallel into main

Plugins use rules like this to declare their ordering requirements:

gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "appstream");

And in gs_plugin_loader_setup_async() those rules are used to set an order number on each plugin and the list of plugins is then sorted by order number. In GNOME Software 41, the plugins were then set up synchronously in series, so plugins later in the list were not set up until after plugins earlier in the list had finished setting up. But in g-s 42 we moved to doing asynchronous setup of each plugin, which means that plugins can no longer depend on their declared GS_PLUGIN_RULE_RUN_AFTER or GS_PLUGIN_RULE_RUN_BEFORE dependencies being fully set up after or before them, respectively.

This is a bug, and it is making the epiphany plugin harder to reason about, so fix it by setting up batches of plugins based on the order numbers: plugins within a batch are set up asynchronously in parallel, and the next batch is not started until all plugins in the previous batch have finished.

Merge request reports