This improves the recipe parser and loader by separating parsing & validation of Objects.
The current system both parses and validates the recipes in one pass, if one value is invalid it prints a stack trace.
The stack trace, however, is not very intuitive.
Parsing & Validation separation
This new system separates parsing errors from validation errors, which will result in the following improvements:
Parsing errors will still print stack traces and should only occur if the config syntax is invalid.
Validation errors are no longer existent, instead it marks invalid values and prints a tree structure of the recipe.
That tree structure displays a detailed breakdown of what went wrong.
Loading mechanism
The current system parses the recipes after it detected that all dependencies were done loading.
This has multiple issues:
If just one dependency fails to load, no recipe will be parsed
parsing may happen at runtime, causing the server to detect it as lag.
The new system instead,
parses all the recipes on startup, and does the first validation pass.
Makes use of as many cores as possible, to speed up the process. Especially noticeable for a large quantity of recipes (but may increase time for small quantity of recipes).
Invalid recipes are printed to the logs.
Recipes that still contain invalid settings, dependent on other plugins, are marked as 'pending'.
After that, it starts to listen for any dependency to load.
Once a dependency is loaded, it runs another validation pass on the still pending recipes:
Any recipes now valid are registered.
The others will wait for another dependency.
To make sure it does not indefinitely wait for possibly failed dependencies, it marks all 'pending' recipes as 'invalid' and prints them to the logs after a specified timeout.
This improves the recipe parser and loader by separating parsing & validation of Objects. The current system both parses and validates the recipes in one pass, if one value is invalid it prints a stack trace. The stack trace, however, is not very intuitive.
Parsing & Validation separation
This new system separates parsing errors from validation errors, which will result in the following improvements:
Loading mechanism
The current system parses the recipes after it detected that all dependencies were done loading.
This has multiple issues:
The new system instead,
After that, it starts to listen for any dependency to load. Once a dependency is loaded, it runs another validation pass on the still pending recipes:
To make sure it does not indefinitely wait for possibly failed dependencies, it marks all 'pending' recipes as 'invalid' and prints them to the logs after a specified timeout.