remove shutdown and done channels from db and use stop group
This commit is contained in:
parent
1822fc4064
commit
31e91f67c8
3 changed files with 5 additions and 8 deletions
9
db/db.go
9
db/db.go
|
@ -60,8 +60,6 @@ type ReadOnlyDBColumnFamily struct {
|
||||||
FilteredStreams map[string][]byte
|
FilteredStreams map[string][]byte
|
||||||
FilteredChannels map[string][]byte
|
FilteredChannels map[string][]byte
|
||||||
Grp *stop.Group
|
Grp *stop.Group
|
||||||
ShutdownChan chan struct{}
|
|
||||||
DoneChan chan struct{}
|
|
||||||
Cleanup func()
|
Cleanup func()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,8 +599,7 @@ func GetDBColumnFamilies(name string, secondayPath string, cfNames []string) (*R
|
||||||
LastState: nil,
|
LastState: nil,
|
||||||
Height: 0,
|
Height: 0,
|
||||||
Headers: nil,
|
Headers: nil,
|
||||||
ShutdownChan: make(chan struct{}, 1),
|
Grp: nil,
|
||||||
DoneChan: make(chan struct{}, 1),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = myDB.ReadDBState() //TODO: Figure out right place for this
|
err = myDB.ReadDBState() //TODO: Figure out right place for this
|
||||||
|
@ -694,8 +691,8 @@ func (db *ReadOnlyDBColumnFamily) RunDetectChanges(notifCh chan<- interface{}) {
|
||||||
log.Infof("Error detecting changes: %#v", err)
|
log.Infof("Error detecting changes: %#v", err)
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
case <-db.ShutdownChan:
|
case <-db.Grp.Ch():
|
||||||
db.DoneChan <- struct{}{}
|
db.Grp.Done()
|
||||||
return
|
return
|
||||||
case <-time.After(time.Millisecond * 10):
|
case <-time.After(time.Millisecond * 10):
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,8 +93,7 @@ func OpenAndFillTmpDBColumnFamlies(filePath string) (*dbpkg.ReadOnlyDBColumnFami
|
||||||
LastState: nil,
|
LastState: nil,
|
||||||
Height: 0,
|
Height: 0,
|
||||||
Headers: nil,
|
Headers: nil,
|
||||||
ShutdownChan: make(chan struct{}, 1),
|
Grp: nil,
|
||||||
DoneChan: make(chan struct{}, 1),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// err = dbpkg.ReadDBState(myDB) //TODO: Figure out right place for this
|
// err = dbpkg.ReadDBState(myDB) //TODO: Figure out right place for this
|
||||||
|
|
|
@ -275,6 +275,7 @@ func MakeHubServer(grp *stop.Group, args *Args) *Server {
|
||||||
logrus.Warning(err)
|
logrus.Warning(err)
|
||||||
}
|
}
|
||||||
myDB.Grp = stop.New(grp)
|
myDB.Grp = stop.New(grp)
|
||||||
|
myDB.Grp.Add(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine which chain to use based on db and cli values
|
// Determine which chain to use based on db and cli values
|
||||||
|
|
Loading…
Reference in a new issue