This commit is contained in:
shoopea 2019-05-31 23:05:19 +08:00
parent 665f3fff73
commit 9fe6e33e12

2
job.go
View File

@ -110,7 +110,7 @@ func loadCurrentJobs() ([]Job, error) {
_, err := db.Exec("UPDATE obj_job j SET j.pulled = ?, j.in_work = 1 WHERE j.is_done = 0 AND j.in_work = 0 AND j.schedule <= ? ORDER BY j.priority ASC, j.obj_id ASC LIMIT ?;", time.Now(), time.Now(), SQLJobSliceSize) _, err := db.Exec("UPDATE obj_job j SET j.pulled = ?, j.in_work = 1 WHERE j.is_done = 0 AND j.in_work = 0 AND j.schedule <= ? ORDER BY j.priority ASC, j.obj_id ASC LIMIT ?;", time.Now(), time.Now(), SQLJobSliceSize)
logOnError(err, "loadCurrentJobs : update intial rows") logOnError(err, "loadCurrentJobs : update intial rows")
stmt, err := db.Prepare("SELECT o.id, o.obj_sub_type_id, j.status, j.user_id, j.payload FROM obj_job j, obj o WHERE j.obj_id = o.id AND j.is_done = 0 AND j.in_work = 1 AND ORDER BY j.priority ASC, j.obj_id ASC;") stmt, err := db.Prepare("SELECT o.id, o.obj_sub_type_id, j.status, j.user_id, j.payload FROM obj_job j, obj o WHERE j.obj_id = o.id AND j.is_done = 0 AND j.in_work = 1 ORDER BY j.priority ASC, j.obj_id ASC;")
logOnError(err, "loadCurrentJobs : prepare select statement") logOnError(err, "loadCurrentJobs : prepare select statement")
rows, err := stmt.Query() rows, err := stmt.Query()