Erratic Response as to Remaining Quota

Hi,

I am trying to extract the remaining quota from the response headers provided by ORS. Regardless whether I do so in Javascript or in C#, I get (sometimes, but not always) erratic results, both with respect to the reset timestamp and the remaining quota. Attached is a C# HttpMessageResponse.Headers.ToString() string with a X-Ratelimit-Remaining: 1904 and a snapshot of the ORS dashboard taken right after.

I am not sure I am doing everything right, but I would appreciate your advice.


Server: nginx/1.19.2
Date: Tue, 04 May 2021 21:09:49 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Access-Control-Allow-Origin,Access-Control-Allow-Credentials, x-ratelimit-remaining, x-ratelimit-reset, x-ratelimit-limit
X-Ratelimit-Limit: 2000
X-Ratelimit-Remaining: 1904
X-Ratelimit-Reset: 1620169197
Access-Control-Allow-Methods: OPTIONS,GET,POST
Access-Control-Allow-Headers: Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Authorization, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers

Best regards Uli

In addition to what I posted last night, pls find below parts of a log file established this morning that highlights both the remaining quota and the reset time fed back by ORS. As you can tell, the requests to ors are fired from within a loop and in rapid succession, does that cause issues?

2021-05-05T09:24:59 [FTL] ors request: way to Stabenberg
2021-05-05T09:24:59 [FTL] remaining: 1731, reset: 05.05 2021 04:38
2021-05-05T09:24:59 [FTL] ors request: way to Wallberg Hütte
2021-05-05T09:24:59 [FTL] remaining: 1730, reset: 05.05 2021 04:38
2021-05-05T09:24:59 [FTL] ors request: way to Eckkopf
2021-05-05T09:25:00 [FTL] remaining: 96, reset: 06.05 2021 07:42 ***
2021-05-05T09:25:00 [FTL] ors request: way to Waldschenke / Deidesheimer Hütte
2021-05-05T09:25:00 [FTL] remaining: 1728, reset: 04.05 2021 06:30
2021-05-05T09:25:00 [FTL] ors request: way to Kirchberg
2021-05-05T09:25:00 [FTL] remaining: 1727, reset: 03.05 2021 07:56
2021-05-05T09:25:00 [FTL] ors request: way to Bürgerstube Lambrecht
2021-05-05T09:25:01 [FTL] remaining: 1992, reset: 06.05 2021 08:49 ***
2021-05-05T09:25:01 [FTL] ors request: way to startPoint
2021-05-05T09:25:01 [FTL] remaining: 1725, reset: 30.04 2021 07:01
2021-05-05T09:25:01 [FTL] closing loop

Hi @UliE,

please see:

this is sadly still an issue. Do you defenitely need the exact remaining number to partition your requests?
Otherwise i suggest you call until you run into 429 responses.

Thanks for your quick reply. I will try and implement a counting mechanism on my own. To that effect, is the use rate calculated on a rolling basis (x requests in the last 24 hrs) or for a fixed time span (i.e., x requests per calendar day)?

Regards Uli

See Strange error returned and missing return header - #2 by amandus

It depends on when you are using your requests. There is no general reset time.

Thanks again, I do appreciate your feedback

Regards Uli