Mercurial > hg
comparison mercurial/httppeer.py @ 42158:69921d02daaf
peer: introduce a limitedarguments attributes
When set to True, it signal that the peer cannot receive too larges arguments
and that algorithm must adapt. This should only be True for http peer that does
not support argument passed as "post".
This will be useful to unlock better discovery performance in the next
changesets.
I am using a dedicated argument because this is not really a usual
"capabilities" things. An alternative approach would be to adds a
"large-arguments" to all peer, but the http peers. That seemed a bit too hacky
to me.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 17 Apr 2019 17:56:30 +0200 |
parents | a9b609fbe39c |
children | 268662aac075 |
comparison
equal
deleted
inserted
replaced
42157:7755b89cadaf | 42158:69921d02daaf |
---|---|
380 def __init__(self, ui, path, url, opener, requestbuilder, caps): | 380 def __init__(self, ui, path, url, opener, requestbuilder, caps): |
381 self.ui = ui | 381 self.ui = ui |
382 self._path = path | 382 self._path = path |
383 self._url = url | 383 self._url = url |
384 self._caps = caps | 384 self._caps = caps |
385 self.limitedarguments = caps is not None and 'httppostargs' not in caps | |
385 self._urlopener = opener | 386 self._urlopener = opener |
386 self._requestbuilder = requestbuilder | 387 self._requestbuilder = requestbuilder |
387 | 388 |
388 def __del__(self): | 389 def __del__(self): |
389 for h in self._urlopener.handlers: | 390 for h in self._urlopener.handlers: |
748 while handler.readdata(resp): | 749 while handler.readdata(resp): |
749 pass | 750 pass |
750 | 751 |
751 @interfaceutil.implementer(repository.ipeerv2) | 752 @interfaceutil.implementer(repository.ipeerv2) |
752 class httpv2peer(object): | 753 class httpv2peer(object): |
754 | |
755 limitedarguments = False | |
756 | |
753 def __init__(self, ui, repourl, apipath, opener, requestbuilder, | 757 def __init__(self, ui, repourl, apipath, opener, requestbuilder, |
754 apidescriptor): | 758 apidescriptor): |
755 self.ui = ui | 759 self.ui = ui |
756 self.apidescriptor = apidescriptor | 760 self.apidescriptor = apidescriptor |
757 | 761 |