Commit ab13152e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 43838f7c
...@@ -141,8 +141,8 @@ func NewDB(stor IStorage) *DB { ...@@ -141,8 +141,8 @@ func NewDB(stor IStorage) *DB {
// shutdown marks db no longer operational due to reason. // shutdown marks db no longer operational due to reason.
// //
// It serves both explicit Close, or shutdown triggered due to error received // It serves both either explicit Close, or shutdown triggered due to error
// by watcher. Only the first shutdown call has the effect. // received by watcher. Only the first shutdown call has the effect.
func (db *DB) shutdown(reason error) { func (db *DB) shutdown(reason error) {
db.downOnce.Do(func() { db.downOnce.Do(func() {
db.downErr = reason db.downErr = reason
...@@ -155,7 +155,7 @@ func (db *DB) shutdown(reason error) { ...@@ -155,7 +155,7 @@ func (db *DB) shutdown(reason error) {
// Close closes database handle. // Close closes database handle.
// //
// After Close DB.Open calls will return error. However it is ok to continue // After Close DB.Open calls will return error. However it is ok to continue
// working with connections opened prior Close. // to use connections opened prior to Close.
func (db *DB) Close() error { func (db *DB) Close() error {
db.shutdown(fmt.Errorf("db is closed")) db.shutdown(fmt.Errorf("db is closed"))
return nil return nil
...@@ -222,7 +222,7 @@ func (db *DB) watcher() (err error) { ...@@ -222,7 +222,7 @@ func (db *DB) watcher() (err error) {
for { for {
select { select {
case <-db.down: case <-db.down:
// should be already shut down with concrete reason // db is already shut down with concrete reason
return fmt.Errorf("db is down") return fmt.Errorf("db is down")
case event, ok = <-db.watchq: case event, ok = <-db.watchq:
......
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