Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

server: only suggest a max of one pack per receive-objects cycle.

Since the client only handles one at a time and forgets the others anyway,
suggesting others is a bit of a waste of time... and because of the cheating
way we figure out which index to suggest when using a midx, suggesting packs
is more expensive than it should be anyway.

The "correct" fix in the long term will be to make the client accept
multiple suggestions at once, plus make midx files a little smarter about
figuring out which pack is the one that needs to be suggested.  But in the
meantime, this makes things a little nicer: there are fewer confusing log
messages from the server, and a lot less disk grinding related to looking
into which pack to suggest, followed by finding out that we've already
suggested that pack anyway.
  • Loading branch information...
commit cc4943941543a35b500ad608c64c8517058a982b 1 parent 92ce940
apenwarr apenwarr authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 cmd/server-cmd.py
9 cmd/server-cmd.py
View
@@ -76,7 +76,12 @@ def receive_objects(conn, junk):
(type, content) = git._decode_packobj(buf)
sha = git.calc_hash(type, content)
oldpack = w.exists(sha)
- if oldpack and (oldpack == True or oldpack.endswith('.midx')):
+ # FIXME: we only suggest a single index per cycle, because the client
+ # is currently dumb to download more than one per cycle anyway.
+ # Actually we should fix the client, but this is a minor optimization
+ # on the server side.
+ if not suggested and \
+ oldpack and (oldpack == True or oldpack.endswith('.midx')):
# FIXME: we shouldn't really have to know about midx files
# at this layer. But exists() on a midx doesn't return the
# packname (since it doesn't know)... probably we should just
@@ -90,7 +95,7 @@ def receive_objects(conn, junk):
assert(oldpack != True)
assert(not oldpack.endswith('.midx'))
w.objcache.refresh(skip_midx = False)
- if oldpack:
+ if not suggested and oldpack:
assert(oldpack.endswith('.idx'))
(dir,name) = os.path.split(oldpack)
if not (name in suggested):
Please sign in to comment.
Something went wrong with that request. Please try again.