mirror of
https://github.com/nonoo/kappanhang.git
synced 2026-04-21 06:13:43 +00:00
Add support for restarting the whole process on failure
This commit is contained in:
parent
9dbd5760ce
commit
f79d23f755
10 changed files with 677 additions and 310 deletions
17
seqbuf.go
17
seqbuf.go
|
|
@ -232,7 +232,11 @@ func (s *seqBuf) watcher() {
|
|||
e, err := s.get()
|
||||
if err == nil {
|
||||
if s.entryChan != nil {
|
||||
s.entryChan <- e
|
||||
select {
|
||||
case s.entryChan <- e:
|
||||
case <-s.watcherCloseNeededChan:
|
||||
return
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.Error(err)
|
||||
|
|
@ -271,7 +275,10 @@ func (s *seqBuf) init(length time.Duration, maxSeqNum, maxSeqNumDiff seqNum, ent
|
|||
go s.watcher()
|
||||
}
|
||||
|
||||
// func (s *seqBuf) deinit() {
|
||||
// s.watcherCloseNeededChan <- true
|
||||
// <-s.watcherCloseDoneChan
|
||||
// }
|
||||
func (s *seqBuf) deinit() {
|
||||
if s.watcherCloseNeededChan == nil { // Init has not ran?
|
||||
return
|
||||
}
|
||||
s.watcherCloseNeededChan <- true
|
||||
<-s.watcherCloseDoneChan
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue