fixed closing of caches

master
Oliver Tonnhofer 2013-06-20 10:34:22 +02:00
parent ecd5541c1e
commit 03d96b5aae
2 changed files with 10 additions and 4 deletions

10
cache/osm.go vendored
View File

@ -39,6 +39,10 @@ func (c *OSMCache) Close() {
c.Relations.Close()
c.Relations = nil
}
if c.InsertedWays != nil {
c.InsertedWays.Close()
c.InsertedWays = nil
}
}
func NewOSMCache(dir string) *OSMCache {
@ -172,8 +176,12 @@ func idFromKeyBuf(buf []byte) int64 {
}
func (c *Cache) Close() {
c.db.Close()
if c.db != nil {
c.db.Close()
c.db = nil
}
if c.cache != nil {
c.cache.Close()
c.cache = nil
}
}

View File

@ -227,9 +227,7 @@ func main() {
// blocks till the Nodes.Iter() finishes
nodeWriter.Close()
osmCache.Nodes.Close()
osmCache.Coords.Close()
osmCache.Coords.SetReadOnly(false)
osmCache.Close()
err = db.End()
if err != nil {