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

8
cache/osm.go vendored
View File

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

View File

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