2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-12-25 23:32:17 +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),
}
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)