[GH-ISSUE #158] [BUG] Enqueue shouldn't call schedule #1062

Closed
opened 2026-03-07 22:05:00 +03:00 by kerem · 2 comments
Owner

Originally created by @xuyang2 on GitHub (Jun 4, 2020).
Original GitHub issue: https://github.com/hibiken/asynq/issues/158

Originally assigned to: @hibiken on GitHub.

Describe the bug
When you call client.Enqueue(task) it shouldn't be calling schedule()

To Reproduce
Steps to reproduce the behavior (Code snippets if applicable):
just call client.Enqueue(task)

Expected behavior
When you call client.Enqueue(task) it should call enqueue()

Screenshots
image

Environment (please complete the following information):

  • OS: Windows
  • Version of asynq package: a38f628f3b

Additional context

t1 := time.Now()
t2 := time.Now()
fmt.Printf("delta nanos: %v\n", t2.UnixNano()-t1.UnixNano()) // Probably 0
fmt.Printf("t2 after t1: %v\n", t2.After(t1))                // Probably false
fmt.Printf("t2 not before t1: %v\n", !t2.Before(t1))         // Should be true

https://play.golang.org/p/K41KEKdMIQg

I guess L235 can change a little to make it more reliable. eg.

if time.Now().UnixNano() >= t.UnixNano() {
if !time.Now().Before(t) {
if !t.After(time.Now()) {

github.com/hibiken/asynq@a38f628f3b/client.go (L235-L239)

Originally created by @xuyang2 on GitHub (Jun 4, 2020). Original GitHub issue: https://github.com/hibiken/asynq/issues/158 Originally assigned to: @hibiken on GitHub. **Describe the bug** When you call `client.Enqueue(task)` it shouldn't be calling `schedule()` **To Reproduce** Steps to reproduce the behavior (Code snippets if applicable): just call `client.Enqueue(task)` **Expected behavior** When you call `client.Enqueue(task)` it should call `enqueue()` **Screenshots** ![image](https://user-images.githubusercontent.com/6643001/83714119-764a3c00-a65c-11ea-92a9-fd5ac0da2f47.png) **Environment (please complete the following information):** - OS: Windows - Version of `asynq` package: a38f628f3b24090a63bececc44d87e11d9edbb75 **Additional context** ```go t1 := time.Now() t2 := time.Now() fmt.Printf("delta nanos: %v\n", t2.UnixNano()-t1.UnixNano()) // Probably 0 fmt.Printf("t2 after t1: %v\n", t2.After(t1)) // Probably false fmt.Printf("t2 not before t1: %v\n", !t2.Before(t1)) // Should be true ``` https://play.golang.org/p/K41KEKdMIQg I guess L235 can change a little to make it more reliable. eg. ```go if time.Now().UnixNano() >= t.UnixNano() { if !time.Now().Before(t) { if !t.After(time.Now()) { ``` https://github.com/hibiken/asynq/blob/a38f628f3b24090a63bececc44d87e11d9edbb75/client.go#L235-L239
kerem 2026-03-07 22:05:00 +03:00
Author
Owner

@hibiken commented on GitHub (Jun 4, 2020):

@xuyang2 thank you for opening this issue!
I'll look into this once I'm finished with my current feature work. But if someone wants to take this bug, please feel free to take this bug and open a PR 👍

<!-- gh-comment-id:638858939 --> @hibiken commented on GitHub (Jun 4, 2020): @xuyang2 thank you for opening this issue! I'll look into this once I'm finished with my current feature work. But if someone wants to take this bug, please feel free to take this bug and open a PR 👍
Author
Owner

@hibiken commented on GitHub (Jun 14, 2020):

@xuyang2 I had trouble reproducing this bug on my machine (the conditional always evaluated to true for me) so I couldn't add a test case to reproduce the bug.
But it should be fixed by #171. Please reopen this issue if you continue to see the behavior. thanks!

<!-- gh-comment-id:643763183 --> @hibiken commented on GitHub (Jun 14, 2020): @xuyang2 I had trouble reproducing this bug on my machine (the conditional always evaluated to `true` for me) so I couldn't add a test case to reproduce the bug. But it should be fixed by #171. Please reopen this issue if you continue to see the behavior. thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#1062
No description provided.