Open joker234 opened 3 years ago
I rather see this as an enhancement, as the functionality of dealing with a failing DB connection is just not there yet. You can argue though that the state in which the ohsome API goes after such an incidence is somewhat 'buggy'.
Improve connection handling in the ohsome API. Especially, reconnect automatically and don't return errors like this if a connection is possible again: java.lang.RuntimeException: The timerange metadata could not be retrieved from the db.
This error message is a cause of a failing connection though, so that's something good already meaning the API does not just fail when the DB is gone. I agree it should try to reconnect automatically then, but for that we'd have to implement also an automatic check to see if the DB connection is still there and working, right?
Basically using a ConnectionPool (e.g. Hikari) would already solve the problem, as it trys to reconnect if the connection is closed! Also have one connection per thread is also advisable and would fix the problem with the IgniteThinDriver which is not multithreaded!
in the long term, https://github.com/GIScience/oshdb/issues/225 might become relevant
also related issue: #37
java.lang.RuntimeException: The timerange metadata could not be retrieved from the db.
Regarding this error, avoiding to extract metadata for every request should solve the problem.
The ohsome API should handle database connection issues better. Currently, if there is a network hickup or the database restarts for some reason, the ohsome API doesn't notice that. It just returns errors if the database is used. I would even consider this as a bug, feel free to change the labelling if you don't agree.
I think there are multiple possibilities to improve the database-connection behaviour:
java.lang.RuntimeException: The timerange metadata could not be retrieved from the db.