Use time.Until instead of t.Sub(time.Now())

This commit is contained in:
Adriano Caloiaro 2023-02-15 10:59:59 -08:00
parent fc011c9c84
commit 84826b5f0a
No known key found for this signature in database
GPG key ID: 890FFDB11860FE1C

View file

@ -653,7 +653,7 @@ func (w pgWorker) updateJob(ctx context.Context, jobErr error) (err error) {
_, err = tx.Exec(ctx, qstr, time.Now(), errMsg, status, job.ID)
}
if err == nil && runAfter.Sub(time.Now()) > 0 {
if err == nil && time.Until(runAfter) > 0 {
w.mu.Lock()
w.futureJobs[job.ID] = runAfter
w.mu.Unlock()