This commit is contained in:
shoopea 2019-05-10 17:28:05 +08:00
parent 6b6b33e078
commit ae5d619cfb
2 changed files with 3 additions and 2 deletions

1
def.go
View File

@ -115,6 +115,7 @@ const (
SQLCWMsgWorkers = 6
SQLIdentifyMsgWorkers = 6
SQLJobWorkers = 3
SQLJobSliceSize = 25
)
var (

4
sql.go
View File

@ -1385,10 +1385,10 @@ func loadCurrentJobs() ([]Job, error) {
}
defer tx.Rollback()
stmt, err := tx.Prepare("SELECT o.id, o.obj_sub_type_id, j.payload FROM obj_job j, obj o WHERE j.obj_id = o.id AND j.status = ? AND j.schedule <= ? ORDER BY j.prio ASC LIMIT 10 FOR UPDATE;")
stmt, err := tx.Prepare("SELECT o.id, o.obj_sub_type_id, j.payload FROM obj_job j, obj o WHERE j.obj_id = o.id AND j.status = ? AND j.schedule <= ? ORDER BY j.prio ASC LIMIT ? FOR UPDATE;")
logOnError(err, "loadCurrentJobs : prepare select statement")
rows, err := stmt.Query(objJobStatusNew, time.Now())
rows, err := stmt.Query(objJobStatusNew, time.Now(), SQLJobSliceSize)
logOnError(err, "loadCurrentJobs : query select statement")
for rows.Next() {