t2bot / matrix-media-repo

Highly configurable multi-domain media repository for Matrix.

Home Page:https://docs.t2bot.io/matrix-media-repo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

improve stability

mpldr opened this issue · comments

As one of the basic Go Proverbs states Don't Panic

$ grep panic\( -r . | wc -l
73

This can get rather annoying when there is a number of tasks to perform for which an indeterminate amount of items can fail (for example a migration). It would be better to continue on and output items missing from the original media store afterwards. Preferably in a machine-readable list.

Seeing how this is all over the runtime, consistency checks, importers, and routers, this should probably be addressed overall. Go doesn't have try-catch for a reason after all.

Panic is used to deliberately kill the application context if something unrecoverable is encountered - the application should not continue because the application state is unsafe. There are certainly some panics which may need refinement, but as a general concept there are recover() calls in places to localize the impact, such as the routers.

If you have a specific error message or panic you think shouldn't be fatal, please open an issue for those individually.