Transport connection caches must go.
Martin Pool
mbp at canonical.com
Wed May 24 01:59:56 BST 2006
On 23 May 2006, Robey Pointer <robey at lag.net> wrote:
> On 23 May 2006, at 7:51, John A Meinel wrote:
> >The reason we have per-transport caches, is because we cache
> >different things for each transport. And the key for the cache may be
> >different. I personally don't like that the ftp cache includes the
> >password in its key, as I don't like to remember passwords.
> >
> >We could cache the Transport objects themselves (say based on the
> >netloc portion of the URL), and then have get_transport() do a
> >clone() if there is a matching netloc. And then we would add a
> >transport.flush_cache() function, which could be called by the test
> >suite.
>
> I like a variation of this idea.
>
> We only really want to check for reuse against currently-open
> transports, right? So what if we added a method to Transport to ask
> if it can clone itself for an url? Like so:
>
> new_transport = old_transport.try_clone(url)
>
> If the URL is incompatible (you asked an sftp transport to clone an
> http url), it returns None.
That might be reasonable; so then if you were doing something on a
remote bound branch whose master is on the same server it could discover
that they should use the same connection.
(But possibly this should be at a higher level, because this needs to
deal with locks as well.)
Incidentally I don't think 'clone' is such a great name, maybe "chdir"
would be better, or something that conveys that we're creating a new
related object.
This is fundamentally not a cache - the term implies that if you
happen to not find something in the cache you can get it from somewhere
else, whereas here it's about more than just performance because
reconnecting might need the user to reauthenticate.
--
Martin
More information about the bazaar
mailing list