harmony: utc times in task_history queries

This commit is contained in:
Łukasz Magiera 2024-01-12 14:14:40 +01:00
parent 6c8605c077
commit afc124ab2a
2 changed files with 2 additions and 2 deletions

View File

@ -233,7 +233,7 @@ func (e *TaskEngine) followWorkInDB() {
for fromName, srcs := range e.follows { for fromName, srcs := range e.follows {
var cList []int // Which work is done (that we follow) since we last checked? var cList []int // Which work is done (that we follow) since we last checked?
err := e.db.Select(e.ctx, &cList, `SELECT h.task_id FROM harmony_task_history err := e.db.Select(e.ctx, &cList, `SELECT h.task_id FROM harmony_task_history
WHERE h.work_end>$1 AND h.name=$2`, lastFollowTime, fromName) WHERE h.work_end>$1 AND h.name=$2`, lastFollowTime.UTC(), fromName)
if err != nil { if err != nil {
log.Error("Could not query DB: ", err) log.Error("Could not query DB: ", err)
return return

View File

@ -218,7 +218,7 @@ retryRecordCompletion:
} }
_, err = tx.Exec(`INSERT INTO harmony_task_history _, err = tx.Exec(`INSERT INTO harmony_task_history
(task_id, name, posted, work_start, work_end, result, completed_by_host_and_port, err) (task_id, name, posted, work_start, work_end, result, completed_by_host_and_port, err)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)`, tID, h.Name, postedTime, workStart, workEnd, done, h.TaskEngine.hostAndPort, result) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)`, tID, h.Name, postedTime.UTC(), workStart.UTC(), workEnd.UTC(), done, h.TaskEngine.hostAndPort, result)
if err != nil { if err != nil {
return false, fmt.Errorf("could not write history: %w", err) return false, fmt.Errorf("could not write history: %w", err)
} }