mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-09 14:41:02 +00:00
more cleanup code on panic shutdown
This commit is contained in:
parent
afa42e1af0
commit
aa00270de8
1 changed files with 10 additions and 0 deletions
|
|
@ -468,6 +468,15 @@ func (self *Fragment) processCommand(req Command) {
|
|||
req.ResponseChannel() <- Result{answer, delta}
|
||||
}
|
||||
func (self *Fragment) ServeFragment(loadChan chan Command) {
|
||||
ispanic := true
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
if ispanic {
|
||||
self.Persist()
|
||||
}
|
||||
}
|
||||
|
||||
}()
|
||||
for {
|
||||
select {
|
||||
case req := <-self.requestChan:
|
||||
|
|
@ -481,6 +490,7 @@ func (self *Fragment) ServeFragment(loadChan chan Command) {
|
|||
case wg := <-self.exit:
|
||||
log.Println("Fragment Shutdown")
|
||||
self.Persist()
|
||||
ispanic = false
|
||||
wg.Done()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue