debug timeout

This commit is contained in:
shoopea 2019-08-29 18:38:35 +08:00
parent 5022f97e6f
commit 0de365d4f8

5
job.go
View File

@ -80,6 +80,8 @@ func setJobCallback(jobID64 int64, userID64 int64, msgTypeID64 int64) {
} }
func setJobTimeout(jobID64 int64, d time.Duration) error { func setJobTimeout(jobID64 int64, d time.Duration) error {
log.Printf("setJobTimeout(%d) : %s.\n", jobID64, time.Now().UTC().Add(d))
stmt, err := db.Prepare(`UPDATE obj_job j SET j.timeout = ? WHERE j.obj_id = ?;`) stmt, err := db.Prepare(`UPDATE obj_job j SET j.timeout = ? WHERE j.obj_id = ?;`)
logOnError(err, "setJobTimeout : prepare update obj_job") logOnError(err, "setJobTimeout : prepare update obj_job")
if err != nil { if err != nil {
@ -88,8 +90,7 @@ func setJobTimeout(jobID64 int64, d time.Duration) error {
defer stmt.Close() defer stmt.Close()
_, err = stmt.Exec(time.Now().UTC().Add(d), jobID64) _, err = stmt.Exec(time.Now().UTC().Add(d), jobID64)
s := fmt.Sprintf("setJobTimeout, update obj_job(%d)", jobID64) logOnError(err, fmt.Sprintf("setJobTimeout, update obj_job(%d)", jobID64))
logOnError(err, s)
if err != nil { if err != nil {
return err return err
} }