[PATCH] fix bound branch SFTP test speed, and optimise somewhat.

Andrew Bennetts andrew at canonical.com
Mon Mar 27 03:09:02 BST 2006


On Sun, Mar 26, 2006 at 07:50:09AM +1100, Robert Collins wrote:
[...]
> === modified file 'a/bzrlib/transport/sftp.py'
> --- a/bzrlib/transport/sftp.py	
> +++ b/bzrlib/transport/sftp.py	
> @@ -183,6 +183,14 @@
>  # sort of expiration policy, such as disconnect if inactive for
>  # X seconds. But that requires a lot more fanciness.
>  _connected_hosts = weakref.WeakValueDictionary()
> +
> +def clear_connection_cache():
> +    """Remove all hosts from the SFTP connection cache.
> +
> +    Primarily useful for test cases wanting to force garbage collection.
> +    """
> +    while _connected_hosts:
> +        _connected_hosts.popitem()
>  
>  
>  def load_host_keys():
> 

This part will fix https://launchpad.net/products/bzr/+bug/36294, so I hope this
gets merged :)

I don't know why the body of this method isn't simply _connected_hosts.clear(),
though.

-Andrew.





More information about the bazaar mailing list