cache: catch signal interrupt for bolt handle cleanup
This commit is contained in:
parent
2497ca5134
commit
569c1a2ec1
2 changed files with 24 additions and 0 deletions
8
cache/storage_persistent.go
vendored
8
cache/storage_persistent.go
vendored
|
@ -739,6 +739,14 @@ func (b *Persistent) iterateBuckets(buk *bolt.Bucket, bucketFn func(name string)
|
|||
return err
|
||||
}
|
||||
|
||||
// Close should be called when the program ends gracefully
|
||||
func (b *Persistent) Close() {
|
||||
err := b.db.Close()
|
||||
if err != nil {
|
||||
fs.Errorf(b, "closing handle: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// itob returns an 8-byte big endian representation of v.
|
||||
func itob(v int64) []byte {
|
||||
b := make([]byte, 8)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue