2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-12-27 00:02:19 +08:00

Fix Client.Enqueue to always call enqueue

Closes https://github.com/hibiken/asynq/issues/158
This commit is contained in:
Ken Hibino 2020-06-14 05:31:24 -07:00
parent 8bf5917cd9
commit 4e5f596910

View File

@ -232,7 +232,8 @@ func (c *Client) enqueueAt(t time.Time, task *Task, opts ...Option) error {
UniqueKey: uniqueKey(task, opt.uniqueTTL, opt.queue), UniqueKey: uniqueKey(task, opt.uniqueTTL, opt.queue),
} }
var err error var err error
if time.Now().After(t) { now := time.Now()
if t.Before(now) || t.Equal(now) {
err = c.enqueue(msg, opt.uniqueTTL) err = c.enqueue(msg, opt.uniqueTTL)
} else { } else {
err = c.schedule(msg, t, opt.uniqueTTL) err = c.schedule(msg, t, opt.uniqueTTL)