← Back to team overview

dulwich-users team mailing list archive

Re: RFC: Closing resources and controlling cache life times

 

On Fri, May 1, 2015 at 12:39 AM, Jelmer Vernooij <jelmer@xxxxxxxxx> wrote:

> Actually, I mostly meant to say that treating them as context managers
> is one approach, but there are other options. This is the kind of
> thing we can't easily change once it's been introduced as it it's a
> significant chunk of the public API, so we should be careful.
>

Ah. So maybe we just add Repo.close (no new context managers in the
library) and then we use contextlib.closing in the tests to do

    with closing(repo):
         ....

What kind of operations are we trying to optimize exactly? Which
> Dulwich users (with what access patterns?) are we trying to help?
>
> I'm not convinced statting for existing (but missing) loose objects is
> actually a significant problem at the moment. In what cases would you
> stat for the same object SHA multiple times *and* want avoid a stat?
>
> Not reading/statting the packlist multiple times seems to me like it
> would definitely be a win. Do we need API changes for that though, or
> could we e.g. just use inotify to watch it?
>

I was not aware of the statting for loose objects. I was just thinking
about the statting for pack list.

I'm not sure about this. Caching adds complications; let's start a
> separate thread about what our goals are with this, and the pros/cons
> of the various options.
>

I would personally be happy to leave the caching as is, and only look at
ensuring that we close all files.

Regards,

Gary

References