Too long process if longitude coordinate value is very large
Lately, our machine hosting addok was increasing in memory and CPU load with the need to restart it.
After investigation, many requests of the type GET /reverse?lon=2081535055002022&lat=48.078102 were sent to our server.
It turns out that during a "reverse" the longitude and latitude are transformed into a character string with the instruction (via the geohash library) to re-center the longitude between [-180; 180].
However, the value provided in the request for the longitude is of the order of 10 ^ 15 ... which generates a very very long processing of addok. This processing, multiplied by the number of requests, brings down the machine.
Wouldn't it be possible to do a check before encoding the coordinates?
exemple : core.py (line ~ 320)
if lon > 360 * 5 or lon < -360 * 5:
raise Exception("Encoding coordinates take too long")
geoh = geohash.encode(lat, lon, config.GEOHASH_PRECISION)
cordially
fixed by https://github.com/addok/addok/commit/aae1fbc985b6efe2b13bffa530c81de71794ef57