You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
X-RateLimit-Remaining decreasing when cache should be used #262
As you can see the Github Api rate remaining decrease...
That's because the api limit is cached in the response, then we literally just unserialize the cached response and get the old api limit. This is not actually the current api limit from the original request.
So you mean in reality my api limit remaining is not moving and I’m correctly using the cache even when I’m fetching the commits inside the foreach? :-)
As you can see the Github Api rate remaining decrease...
That's because the api limit is cached in the response, then we literally just unserialize the cached response and get the old api limit. This is not actually the current api limit from the original request.
—
Reply to this email directly or view it on GitHub #262 (comment).
Ok I got it!
But the number is still decreasing and it shouldn’t! Because the response should be cached and no file(s) change(s) btw each request.
When I fetch the content (files) my api rate remaining doesn’t move because I use the cache. But as soon as I start fetching the commit(s) for each file(s) the api rate remaining seriously decrease for each fetch commits call!
Yes you are right, it decreases after each iteration.
But why does it decrease whereas it is the same content requested?
I think I don’t understand something :(
Logically if the content requested is the same the status code should be == 304 and so the cache should be used. Instead a new request is made against the api and my remaining hits decrease.
As we can see, now the remaining calls number decrease as soon as I introduce the sub requests with the foreach. And of course I don't understand why it is not cached.
The first request has a 304 status code.
Each iteration requests return a 200 status code. So the cache is not used and the X-RateLimit-Remaining decreasing.
@GrahamCampbell please help me. I'm going crazy because I don't understand why these requests inside the iteration are not cached and don't return a 304!
Activity
[-]Cache status[/-][+]Cache not used on foreach...[/+]GrahamCampbell commentedon Apr 26, 2015
That's because the api limit is cached in the response, then we literally just unserialize the cached response and get the old api limit. This is not actually the current api limit from the original request.
jrean commentedon Apr 26, 2015
Thank you Graham,
So you mean in reality my api limit remaining is not moving and I’m correctly using the cache even when I’m fetching the commits inside the foreach? :-)
GrahamCampbell commentedon Apr 26, 2015
Yes. You are just getting the api limit as it was when the original request was made. :)
jrean commentedon Apr 26, 2015
Ok I got it!
But the number is still decreasing and it shouldn’t! Because the response should be cached and no file(s) change(s) btw each request.
When I fetch the content (files) my api rate remaining doesn’t move because I use the cache. But as soon as I start fetching the commit(s) for each file(s) the api rate remaining seriously decrease for each fetch commits call!
It should not because of the cache !
I’m sorry but I don’t understand :)
GrahamCampbell commentedon Apr 26, 2015
It should decrease with each iteration, because the original requests made where one after another.
jrean commentedon Apr 26, 2015
Yes you are right, it decreases after each iteration.
But why does it decrease whereas it is the same content requested?
I think I don’t understand something :(
Logically if the content requested is the same the status code should be == 304 and so the cache should be used. Instead a new request is made against the api and my remaining hits decrease.
Let me update the test:
This test outputs:
As we can see, the remaining calls number don't move because the cache is used for this request.
Now I update the test by adding the sub requests
This test outputs:
As we can see, now the remaining calls number decrease as soon as I introduce the sub requests with the foreach. And of course I don't understand why it is not cached.
What do I miss?
Thank you for your answers Graham.
[-]Cache not used on foreach...[/-][+]X-RateLimit-Remaining decreasing when cache should be used[/+]jrean commentedon Apr 27, 2015
I updated my test:
The output is clear:
The first request has a 304 status code.
Each iteration requests return a 200 status code. So the cache is not used and the X-RateLimit-Remaining decreasing.
@GrahamCampbell please help me. I'm going crazy because I don't understand why these requests inside the iteration are not cached and don't return a 304!
Maybe @pilot?
:)
Another test:
Status code is 304
I update a second commits query:
Status code is always 200 and the X-RateLimit-Remaining decreases by 2.
jrean commentedon Apr 30, 2015
#265