Improve sql query requests timing
This commit is contained in:
parent
dd230dca56
commit
7f0ea653b8
1 changed files with 2 additions and 7 deletions
9
db/db.go
9
db/db.go
|
@ -168,6 +168,7 @@ func Process(ctx *fibre.Context, ast *sql.Query, vars map[string]interface{}) (o
|
||||||
func (e *executor) execute(quit <-chan bool, send chan<- *Response) {
|
func (e *executor) execute(quit <-chan bool, send chan<- *Response) {
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
var now time.Time
|
||||||
var rsp *Response
|
var rsp *Response
|
||||||
var buf []*Response
|
var buf []*Response
|
||||||
var res []interface{}
|
var res []interface{}
|
||||||
|
@ -239,7 +240,7 @@ func (e *executor) execute(quit <-chan bool, send chan<- *Response) {
|
||||||
// next statement is not ignored.
|
// next statement is not ignored.
|
||||||
|
|
||||||
if e.txn == nil {
|
if e.txn == nil {
|
||||||
err = nil
|
err, now = nil, time.Now()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if the current statement is
|
// Check to see if the current statement is
|
||||||
|
@ -258,12 +259,6 @@ func (e *executor) execute(quit <-chan bool, send chan<- *Response) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is not a TRANSACTION statement and
|
|
||||||
// therefore we must time the execution speed
|
|
||||||
// and process the statement response.
|
|
||||||
|
|
||||||
now := time.Now()
|
|
||||||
|
|
||||||
// If an error has occured and we are inside
|
// If an error has occured and we are inside
|
||||||
// a global transaction, then ignore all
|
// a global transaction, then ignore all
|
||||||
// subsequent statements in the transaction.
|
// subsequent statements in the transaction.
|
||||||
|
|
Loading…
Reference in a new issue