-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not alter Cache-Control header sent by GitHub to leverage caching #1123
Conversation
My recollection on this is a bit vague given this was 4 years ago, but I think I stumbled upon cases where some modifications were done in e.g. the web UI and I wondered why they weren't loaded in Octodroid, and it turned out this was due to caching. I simply think we don't want caching at all when fetching API responses because they always have a chance of being outdated, and rather should rely on the ETags instead. |
I understand this concern. Thinking a bit more, artificially constraining the max-age value shields us from a potential unwanted caching behavior (or misbehavior) of the GitHub API, so I see the value in it. |
As for the slow loading of PR reviews: caching would be very helpful here because all review comments for the PR get re-fetched when opening the details screen of a single review (and sometimes this can be very slow). I see that kind of batching logic more useful for PR comments which aren't linked to a specific review (I assume because they were made before the introduction of reviews in GitHub), like the ones seen in rails/rails#12977, which are currently treated as normal comments by OctoDroid. |
@maniac103 Any thoughts? |
More useful in what regard? If you're referring to the PR conversation list and review activity, 8 seconds don't seem that much more useful to me - once you read one comment, the caching effect is gone. That one sounds like it would be more useful to achieve speedup in different ways, e.g. by integrating ReviewActivity into PullRequestActivity. |
I was referring to the code comment
Sure, I'd like to look into removing that weird "review-batching" behavior (if that doesn't cause any regressions) so we can avoid refetching all PR comments when opening the ReviewActivity. |
I've noticed that the app changes the cache
max-age
value received from GitHub from 1 minute to 2 seconds, which forces the app to perform a network request to GitHub almost every time.But the reason on why this was needed sounded strange to me:
How can this lead to problems if all reload requests bypass the cache?
I did some quick testing by editing PR and review comments and I've noticed no issues. Maybe I misunderstood the comment in the code? Am I missing something?
The most apparent benefit of this change is the loading time of the PR review screen, which can get a lot faster (if done within the minute) due to PR /comments and /files responses being served directly from cache.
More generally, it makes the overall experience snappier if you happen to switch back and forth between a bunch of screens, e.g. the files of a commit diff.