Dependency Level of a plugin

Post date: 2025-12-18 05:54:03
Views: 1

Currently, in the metadata.json, there is following feild:

"load_order": "after_db_init" or "load_order": "before_db_init"

which indicates, when should load this plugin - is it before db initialisation or after db initialisation.

Let's assume following situation:

if pluginA defined a function F, and pluginB needs to use that function. That means PluginB is depends upon pluginA. However, there is no way in the current q2a, to define this dependency level. 

So, we have two options:

  • PluginA needs to be loaded before pluginB - This is based on the names of the plugins and order is not correctly predicted.
  • Redeclare the same function with similar logic - this will leads to inconsistency if pluginA modified the function F.

To avoid this, I have added following feild in the metadata.json

"dependency_level": 2, - which indicates, the loading level of plugin. (Lower the dependency number, loads earlier.)

Hence, first all the dependency_level=1 plugins will be loaded, after that dependency_level=2 plugins will be loaded.

The code fix is available at https://github.com/q2a/question2answer/pull/1011/commits/182041865f7003f20d4e8c64d1d82ce7a5f7b7bc

Please click Here to read the full story.
 
Other Top and Latest Questions:
U.S. hits ISIS in Syria with large retaliatory strikes, officials say
Nine of the largest pharma companies ink deals with Trump to lower drug prices
I've studied happiness for 15 years: If you do these 9 things every day, you're more 'emotionally resilient' than most
Italy's Telecom Italia wins $1.2 billion court payout, eyes savings share conversion
Activist Ananym Capital urges LKQ to sell its European auto parts business
How Build-A-Bear went from a penny stock to a retail winner
Lucid's big SUV arrives with high expectations, and big risks
CNBC's Official College Sports Valuations 2025: Top 75 athletic programs
Bank of America says Nvidia and these stocks are its top picks for 2026
S&P 500 coasts to a third year of superior returns. Three key questions for Wall Street entering 2026