Do you need to close a branch? (if so how)

Nicholas Allen nick.allen at onlinehome.de
Wed Feb 25 12:14:59 GMT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincent Ladeuil wrote:
>>>>>> "Nicholas" == Nicholas Allen <nick.allen at onlinehome.de> writes:
> 
>     Nicholas> You may encounter some variation of the problem but it's hard to
>     >> tell without a high level description of what your code is doing.
>     >> 
>     >> Are you polling the branches ? 
> 
>     Nicholas> Yes. My code looks like this:
> 
>     Nicholas>      for branch_emailer in branch_emailers.values():
>     Nicholas>             branch = branch_emailer._branch
> 
> So all those _branch are kept alive right ?
> 
> Where are they coming from ? 

They are opened once only. As long as there is a branch below the
directory being scanned it will remain open.

> 
> Did they already connect to a server ?

Those branches are all local. The problem only happens when I pull from
the parent (which is remote).

> 
>     >> 
>     >> If that's the case, you may want to look at the
>     >> possible_transports parameter in Branch.open.
>     >> 
> 
> That was the important point. Did you look at it ?

Yes but there was no documentation for it so I didn't understand its
purpose...

> 
> It allows you to manage your own set of opened connections via
> the transport objects.
> 
> A trivial implementation could be to do:
> 
> my_transports = []
> 
> and then
> 
> parent_branch = Branch.open(parent_location, possible_transports=my_transports)
> 
> Each new transport will then be added.
> 
> If you do that right you should have no more opened sockets than
> len(my_transports).

I will try your suggestion and see if that helps...

Thanks,

Nick
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmlNj0ACgkQ1+i51gqqEGnnCwCgmV8fKcm7P9TnTDhdu65BzW5I
+TAAoI2WoYu3MR/WTbT8/gm9O9b0NzHf
=n7Wx
-----END PGP SIGNATURE-----



More information about the bazaar mailing list