From 4e5f5969108de59ffd2574471cd2e3399a2f4914 Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Sun, 14 Jun 2020 05:31:24 -0700 Subject: [PATCH] Fix Client.Enqueue to always call enqueue Closes https://github.com/hibiken/asynq/issues/158 --- client.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index 4d57cdf..af0523a 100644 --- a/client.go +++ b/client.go @@ -232,7 +232,8 @@ func (c *Client) enqueueAt(t time.Time, task *Task, opts ...Option) error { UniqueKey: uniqueKey(task, opt.uniqueTTL, opt.queue), } var err error - if time.Now().After(t) { + now := time.Now() + if t.Before(now) || t.Equal(now) { err = c.enqueue(msg, opt.uniqueTTL) } else { err = c.schedule(msg, t, opt.uniqueTTL)