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
Investigate whether we can short-circuit fetch #1252
Did you think about some cheaper way to check if there has been any traffic on a repo? For example, repo reference updates could be assigned some kind of unique ID, and your inquiry could be "get the latest push ID".
We do store a pushed_at field on every repository that is updated with each push. [...]
If this is reliable and works well we could use that to avoid doing a fetch at all for background updates unless something has changed on the remote. This could spare us a great deal of network traffic in some scenarios as git fetch always retrieves a list of all references (including our "hidden" pull refs) and then matches those against the local refspec (run git ls-remote for an idea of what that mean).
For a large repository with a massive amount of pull requests this can actually add up. A "noop" atom/atom fetch takes a little over 2 seconds on my machine and pulls down 341kb of refs. Getting the pushed_at using the API on the other hand takes 0.6 seconds and pulls down 2k of data.
If this is reliable and works well we could use that to avoid doing a fetch at all for background updates unless something has changed on the remote.
I took a quick look at this and it does seem to work reliably for git pushes and web flow commits. It doesn't, however, update when a new PR is created from a fork, targeting the repository in question. For our use case I don't think that's necessary since we don't fetch those refs anyway but it's worth making a note of.
Activity
joshaber commentedon Apr 21, 2017
It'd also mean we'd only have to lock refs when we know something actually changed, relevant to #1128.
niik commentedon May 26, 2017
I took a quick look at this and it does seem to work reliably for git pushes and web flow commits. It doesn't, however, update when a new PR is created from a fork, targeting the repository in question. For our use case I don't think that's necessary since we don't fetch those refs anyway but it's worth making a note of.
shiftkey commentedon Feb 4, 2018
It's about the same time with GraphQL but can be trimmed down to ~60 bytes of output:
j-f1 commentedon Feb 4, 2018
With aliases, you can decrease it even more:
Skip the hourly fetch while GitHub saw no push