Commit 46beeb50 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0419e890
...@@ -145,7 +145,7 @@ func NewDB(stor IStorage) *DB { ...@@ -145,7 +145,7 @@ func NewDB(stor IStorage) *DB {
// by watcher. // by watcher.
func (db *DB) shutdown(reason error) { func (db *DB) shutdown(reason error) {
db.downOnce.Do(func() { db.downOnce.Do(func() {
db.downErr = reason // XXX err ctx db.downErr = reason // XXX err ctx ?
close(db.down) close(db.down)
db.stor.DelWatch(db.watchq) db.stor.DelWatch(db.watchq)
...@@ -205,7 +205,10 @@ type δwaiter struct { ...@@ -205,7 +205,10 @@ type δwaiter struct {
// watcher receives events about new committed transactions and updates δtail. // watcher receives events about new committed transactions and updates δtail.
// //
// it also notifies δtail waiters. // It also notifies δtail waiters.
//
// The watcher stops when it sees either the storage being closed or an error.
// The DB is shutdown on exit.
func (db *DB) watcher() (err error) { func (db *DB) watcher() (err error) {
defer db.shutdown(err) defer db.shutdown(err)
defer xerr.Contextf(&err, "db: watcher") defer xerr.Contextf(&err, "db: watcher")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment