Υποστήριξη για το The Movie Database

First off, I will say that I appreciate that the headers are based off how others have done it.

I am curious about a few things with it though.

X-RateLimit-Reset is basically returning a time. For me to be confident in that time, I have to parse the Date HTTP return header to see what time the server thinks it is. Once I know that, I can compare it to the time that my machine thinks it is and then do a diff between the two, if there is any. There shouldn't be, but you never can tell.

Always makes me feel as though returning a time span in seconds or milliseconds would be better. (Not asking for a change here, just an observation.)

So, the question: 1 second is quite a long time. So when an API request is made and the Reset time is set, is that time rounded up? Down to the nearest second? Left as is and thus we don't have an accurate idea?

e.g. I took the server time, reset time and worked it all out, put in an appropriate delay in seconds, but was a hair's whisper out and got a few 429s returned. Now, I could add 1 second extra delay, but that is 10% of the window, which seems quite extreme.

So if I make my first request and it comes in at 16.999 seconds past. Does the reset time happen at 26.000? 27.000? Or 26.999?

Basically, I am left wondering if it is better to ignore the headers and just measure the 10secs on the machine itself. Even then though, I am left wondering whether there is a variance of up to a 1 second.

1 απάντηση(στη σελίδα 1 από 1)

Jump to last post

Hey @Tokubetsu,

Sorry about the delay in answering your questions. The last 10 days has been bananas.

So, the question: 1 second is quite a long time. So when an API request is made and the Reset time is set, is that time rounded up? Down to the nearest second? Left as is and thus we don't have an accurate idea?

You can actually see the rate limiting code, it's all open source: https://github.com/fanhattan/lua-resty-rate-limit/blob/master/lib/resty/rate/limit.lua

I'm using math.floor on all my time calculations which based on my research rounds down in Lua.

Basically, I am left wondering if it is better to ignore the headers and just measure the 10secs on the machine itself.

I guess it's kind of just personal preference of how you want to build it.

Δεν μπορείτε να βρείτε κάποια ταινία ή σειρά; Συνδεθείτε για να τη δημιουργήσετε.

Σε όλες τις σελίδες

s Εστίαση στη μπάρα αναζήτησης
p Άνοιγμα μενού προφίλ
esc Κλείσιμο ανοιχτού παραθύρου
? Άνοιγμα παραθύρου συντομεύσεων πληκτρολογίου

Στις σελίδες μέσων

b Επιστροφή στην προηγούμενη σελίδα(ή στην αρχική σελίδα όταν είναι εφικτό)
e Μετάβαση στη σελίδα επεξεργασίας

Στις σελίδες κύκλων σειρών

(Δεξιό βέλος) Μετάβαση στον επόμενο κύκλο
(Αριστερό βέλος) Μετάβαση στον προηγούμενο κύκλο

Στις σελίδες επεισοδίων σειρών

(Δεξιό βέλος) Μετάβαση στο επόμενο επεισόδιο
(Αριστερό βέλος) Μετάβαση στο προηγούμενο επεισόδιο

Σε όλες τις σελίδες εικόνων

a Άνοιγμα παραθύρου προσθήκης εικόνας

Σε όλες τις σελίδες επεξεργασίας

t Άνοιγμα επιλογέα μετάφρασης
ctrl+ s Υποβολή φόρμας

Στις σελίδες συζήτησης

n Δημιουργία νέας συζήτησης
w Ρύθμιση κατάστασης παρακολούθησης
p Ρύθμιση ως δημόσια/ιδιωτική
c Ρύθμιση ανοίγματος/κλεισίματος
a Άνοιγμα δραστηριότητας
r Απάντηση στη συζήτηση
l Μετάβαση στην τελευταία απάντηση
ctrl+ enter Υποβολή μηνύματος
(Δεξιό βέλος) Επόμενη σελίδα
(Αριστερό βέλος) Προηγούμενη σελίδα

Ρυθμίσεις

Θέλετε να αξιολογήσετε ή να προσθέσετε αυτό το στοιχείο σε μια λίστα;

Σύνδεση