test
This commit is contained in:
parent
a2cf83994e
commit
f919abfd3f
6
job.go
6
job.go
@ -102,6 +102,7 @@ func loadCurrentJobs(sid int) ([]Job, error) {
|
||||
var (
|
||||
objId int64
|
||||
jobTypeId int32
|
||||
userID64 int64
|
||||
status int32
|
||||
payload []byte
|
||||
jobs []Job
|
||||
@ -110,7 +111,7 @@ func loadCurrentJobs(sid int) ([]Job, error) {
|
||||
_, err := db.Exec("UPDATE obj_job j SET session_id = ?, 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 ?;", sid, time.Now(), time.Now(), SQLJobSliceSize)
|
||||
logOnError(err, "loadCurrentJobs : update intial rows")
|
||||
|
||||
stmt, err := db.Prepare("SELECT o.id, o.obj_sub_type_id, j.status, 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 j.session_id = ? 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 AND j.session_id = ? ORDER BY j.priority ASC, j.obj_id ASC;")
|
||||
logOnError(err, "loadCurrentJobs : prepare select statement")
|
||||
|
||||
rows, err := stmt.Query(sid)
|
||||
@ -118,12 +119,13 @@ func loadCurrentJobs(sid int) ([]Job, error) {
|
||||
logOnError(err, "loadCurrentJobs : query select statement")
|
||||
|
||||
for rows.Next() {
|
||||
err = rows.Scan(&objId, &jobTypeId, &status, &payload)
|
||||
err = rows.Scan(&objId, &jobTypeId, &status, &userID64, &payload)
|
||||
logOnError(err, "loadCurrentJobs : scan query rows")
|
||||
job := Job{
|
||||
ID64: objId,
|
||||
JobTypeID: jobTypeId,
|
||||
Status: status,
|
||||
UserID64: userID64,
|
||||
Payload: payload,
|
||||
}
|
||||
jobs = append(jobs, job)
|
||||
|
Loading…
Reference in New Issue
Block a user