index: GetDirMembers, forgot to close iterator

Could fix too many open files problem with sqlite reported by ajft

Change-Id: Icde85b11dcd96a336d1bba1e15a7665a1b4a874a
This commit is contained in:
mpl 2013-09-12 15:25:31 +02:00
parent 1decd09846
commit 6cf55d78b0
1 changed files with 2 additions and 1 deletions

View File

@ -678,11 +678,12 @@ func (x *Index) EdgesTo(ref blob.Ref, opts *search.EdgesToOpts) (edges []*search
}
// GetDirMembers sends on dest the children of the static directory dir.
func (x *Index) GetDirMembers(dir blob.Ref, dest chan<- blob.Ref, limit int) error {
func (x *Index) GetDirMembers(dir blob.Ref, dest chan<- blob.Ref, limit int) (err error) {
defer close(dest)
sent := 0
it := x.queryPrefix(keyStaticDirChild, dir.String())
defer closeIterator(it, &err)
for it.Next() {
keyPart := strings.Split(it.Key(), "|")
if len(keyPart) != 3 {