EDMarketConnector icon indicating copy to clipboard operation
EDMarketConnector copied to clipboard

[Paranoia] Make EDSM plugin aware of any API limits

Open Athanasius opened this issue 3 years ago • 2 comments

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 avatar Aug 04 '20 21:08 Athanasius

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.

Athanasius avatar Aug 08 '21 17:08 Athanasius

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.

Rixxan avatar Dec 27 '23 04:12 Rixxan