mirror of
https://github.com/rqlite/rqlite.git
synced 2026-01-25 04:16:26 +00:00
Fix possible cause for panic
https://ci.appveyor.com/project/otoolep/rqlite/builds/43643803
This commit is contained in:
@@ -32,9 +32,6 @@ type queuedStatements struct {
|
||||
}
|
||||
|
||||
func mergeQueued(qs []*queuedStatements) *Request {
|
||||
if qs == nil {
|
||||
return nil
|
||||
}
|
||||
var o *Request
|
||||
for i := range qs {
|
||||
if o == nil {
|
||||
@@ -155,9 +152,15 @@ func (q *Queue) run() {
|
||||
timer.Stop()
|
||||
|
||||
writeFn := func() {
|
||||
timer.Stop()
|
||||
if queuedStmts == nil {
|
||||
// Batch size was met, but timer expired before it could be
|
||||
// stopped, so this function was called again. Possibly.
|
||||
return
|
||||
}
|
||||
|
||||
q.sendCh <- mergeQueued(queuedStmts)
|
||||
queuedStmts = nil
|
||||
timer.Stop()
|
||||
}
|
||||
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user