bzr log http+urllib does not work, http+pycurl is too slow

Alexander Belchenko bialix at ukr.net
Wed Dec 12 14:24:32 GMT 2007


Vincent Ladeuil пишет:
>>>>>> "vila" == Vincent Ladeuil <v.ladeuil+lp at free.fr> writes:
> Of course I meant:
> 
> === modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
> --- bzrlib/transport/http/_urllib2_wrappers.py	2007-12-06 22:46:16 +0000
> +++ bzrlib/transport/http/_urllib2_wrappers.py	2007-12-11 20:29:31 +0000
> @@ -134,7 +134,15 @@
>          """
>          if not self.isclosed():
>              # Make sure nothing was left to be read on the socket
> -            data = self.read(self.length)
> +            pending = 0
> +            while self.length and self.length > 1024:
> +                data = self.read(1024)
> +                pending += len(data)
> +            if self.length:
> +                self.read(self.length)
> +                pending += len(data)
> +            if pending:
> +                trace.mutter('%s bytes left on the socket', pending)

Yes, this helps. Now urllib works in the same manner as pycurl. And 
shows how many bytes left on the socket :-)


bzr arguments: [u'--no-plugins', u'log', 
u'http+urllib://HOST:8000/chrome/site/branches/Logic', u'--line']
encoding stdout as sys.stdout encoding 'cp866'
http readv of 930af4714be1e33318bb630b8d626540.rix  offsets => 1 collapsed 1
http readv of 930af4714be1e33318bb630b8d626540.rix  offsets => 1 collapsed 1
56320 bytes left on the socket
http readv of 930af4714be1e33318bb630b8d626540.rix  offsets => 1 collapsed 1
11264 bytes left on the socket
http readv of 930af4714be1e33318bb630b8d626540.pack  offsets => 10 
collapsed 3
http readv of 930af4714be1e33318bb630b8d626540.pack  offsets => 14 
collapsed 4
117253120 bytes left on the socket
http readv of 930af4714be1e33318bb630b8d626540.pack  offsets => 20 
collapsed 5
116243456 bytes left on the socket
http readv of 930af4714be1e33318bb630b8d626540.pack  offsets => 29 
collapsed 4
116255744 bytes left on the socket
http readv of 930af4714be1e33318bb630b8d626540.pack  offsets => 43 
collapsed 4
116270080 bytes left on the socket
http readv of 930af4714be1e33318bb630b8d626540.pack  offsets => 64 
collapsed 6
116298752 bytes left on the socket
http readv of 930af4714be1e33318bb630b8d626540.pack  offsets => 95 
collapsed 9
116324352 bytes left on the socket
http readv of 930af4714be1e33318bb630b8d626540.pack  offsets => 142 
collapsed 6
116369408 bytes left on the socket
http readv of 930af4714be1e33318bb630b8d626540.pack  offsets => 201 
collapsed 17
116418560 bytes left on the socket
http readv of 930af4714be1e33318bb630b8d626540.pack  offsets => 34 
collapsed 3
116500480 bytes left on the socket
return code 0



More information about the bazaar mailing list