Browse Source

fix updateBranchAsync panic handling

pull/165/head
yedf2 4 years ago
parent
commit
da84c58c00
  1. 8
      dtmsvr/svr.go

8
dtmsvr/svr.go

@ -65,8 +65,8 @@ var UpdateBranchAsyncInterval = 200 * time.Millisecond
var updateBranchAsyncChan chan branchStatus = make(chan branchStatus, 1000) var updateBranchAsyncChan chan branchStatus = make(chan branchStatus, 1000)
func updateBranchAsync() { func updateBranchAsync() {
defer dtmutil.RecoverPanic(nil) flushBranchs := func() {
for { // flush branches every second defer dtmutil.RecoverPanic(nil)
updates := []TransBranch{} updates := []TransBranch{}
started := time.Now() started := time.Now()
checkInterval := 20 * time.Millisecond checkInterval := 20 * time.Millisecond
@ -93,5 +93,9 @@ func updateBranchAsync() {
updates = []TransBranch{} updates = []TransBranch{}
} }
} }
}
for { // flush branches every 200ms
flushBranchs()
} }
} }

Loading…
Cancel
Save