EDCD / EDMarketConnector

Downloads commodity market and other station data from the game Elite: Dangerous for use with all popular online and offline trading tools.
GNU General Public License v2.0
991 stars 155 forks source link

[Paranoia] Make EDSM plugin aware of any API limits #662

Closed Athanasius closed 4 months ago

Athanasius commented 4 years ago

I don't think the player API on EDSM actually implements rate limiting.

Presumably if Anthor ever did it would be the same 'leaky bucket' he uses on the non-player endpoints.

So, out of paranoia, let's make the EDSM plugin aware of those headers and do something about them, even if it's only log if the bucket gets near empty.

i.e. on the systems API:

curl --verbose 'https://www.edsm.net/api-v1/systems?systemName=Sol'
...
< x-rate-limit-limit: 360
< x-rate-limit-remaining: 359
< x-rate-limit-reset: 10
...
Athanasius commented 3 years ago

As part of this we can also make this work more like the Inara API code in its plugin, but instead of a straight up timer we pay attention to the limits instead, meaning in many cases we could just send events immediately.

Rixxan commented 9 months ago

Took a whack at this one in 0c2134ca2b87ebb9f2db4a865a2b63e0e55082f2. Will need to test this when I'm back from holiday to make sure it didn't break all the things.