Open basilex opened 7 years ago
Why is it important to you what order they get finalized?
Easy. Db connection for ex, which should be closed at the end, Indicator (specific device for translated messages) for ex should be closed before translator service and so on... (Imagine "GOOD BYE" for display for ukrainian when translation service already closed...) Probably graph of the Fanalizable services should be sorted in reverse order? Thanks!
So your Finalize object functions exec code that depends on the object's dependencies?
I guess that's legitimate.
The map being iterated isn't sorted tho. So it can't just iterate in reverse. It would probably have to keep another array around with the dependency order or capture reverse dependence and walk the tree.
Would you like to make a PR?
Hi, Karl!
The question regarding the order (which in may case is very important) during executing Finalize funcs at the end of an app. So, the code:
Above snippet of code initializes and executes successfully, but at the end of the application inject calls Finalizable funcs in random order...
First run:
Next run:
So, do you have some suggestions or recommendations? Thanks!