change obj_job structure
This commit is contained in:
parent
66c7a2aa0d
commit
92eeda481d
8
job.go
8
job.go
@ -37,8 +37,8 @@ func createJob(jobTypeID int32, priority int32, userID64 int64, trigger int64, s
|
||||
return 0, err
|
||||
}
|
||||
|
||||
stmt, err = db.Prepare(`INSERT INTO obj_job (obj_id, priority, user_id, trigger, seq_nr, schedule, is_done, in_work, inserted, pulled, started, ended, payload)
|
||||
VALUES (?, ?, ?, ?, NULL, ?, 0, 0, ?, NULL, NULL, NULL, ?);`)
|
||||
stmt, err = db.Prepare(`INSERT INTO obj_job (obj_id, priority, user_id, trigger_id, seq_nr, schedule, is_done, in_work, inserted, pulled, started, ended, payload)
|
||||
VALUES (?, ?, ?, ?, NULL, ?, 0, 0, ?, NULL, NULL, NULL, ?);`)
|
||||
logOnError(err, "createJob : prepare insert obj_job")
|
||||
if err != nil {
|
||||
return 0, err
|
||||
@ -110,7 +110,7 @@ func setJobStart(jobId int64) error {
|
||||
}
|
||||
|
||||
func rescheduleJob(jobID64 int64, trigger int64, schedule time.Time) error {
|
||||
stmt, err := db.Prepare(`UPDATE obj_job j SET j.is_done = 0, j.in_work = 0, j.schedule = ?, j.trigger = ? WHERE j.obj_id = ?;`)
|
||||
stmt, err := db.Prepare(`UPDATE obj_job j SET j.is_done = 0, j.in_work = 0, j.schedule = ?, j.trigger_id = ? WHERE j.obj_id = ?;`)
|
||||
logOnError(err, "rescheduleJob : prepare update obj_job")
|
||||
if err != nil {
|
||||
return err
|
||||
@ -145,7 +145,7 @@ func loadCurrentJobs() ([]Job, error) {
|
||||
return jobs, err
|
||||
}
|
||||
|
||||
stmt, err := db.Prepare("SELECT o.id, o.obj_sub_type_id, j.trigger, 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.seq_nr = ? ORDER BY j.priority ASC, j.obj_id ASC;")
|
||||
stmt, err := db.Prepare("SELECT o.id, o.obj_sub_type_id, j.trigger_id, 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.seq_nr = ? ORDER BY j.priority ASC, j.obj_id ASC;")
|
||||
logOnError(err, "loadCurrentJobs : prepare select statement")
|
||||
if err != nil {
|
||||
stmt.Close()
|
||||
|
Loading…
Reference in New Issue
Block a user