Skip to content

Commit

Permalink
refactor: refactor job timeout handling in Queue method calls
Browse files Browse the repository at this point in the history
- Refactor `Queue` method calls to use `job.AllowOption` with `Timeout` instead of `job.WithTimeout`

Signed-off-by: appleboy <appleboy.tw@gmail.com>
  • Loading branch information
appleboy committed Jan 19, 2025
1 parent 94f36c8 commit 7bbcc76
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,9 @@ func TestJobReachTimeout(t *testing.T) {
assert.NoError(t, err)
q.Start()
time.Sleep(50 * time.Millisecond)
assert.NoError(t, q.Queue(m, job.WithTimeout(20*time.Millisecond)))
assert.NoError(t, q.Queue(m, job.AllowOption{
Timeout: job.Time(20 * time.Millisecond),
}))
time.Sleep(2 * time.Second)
q.Shutdown()
q.Wait()
Expand Down Expand Up @@ -400,7 +402,9 @@ func TestCancelJobAfterShutdown(t *testing.T) {
assert.NoError(t, err)
q.Start()
time.Sleep(50 * time.Millisecond)
assert.NoError(t, q.Queue(m, job.WithTimeout(3*time.Second)))
assert.NoError(t, q.Queue(m, job.AllowOption{
Timeout: job.Time(3 * time.Second),
}))
time.Sleep(2 * time.Second)
q.Shutdown()
q.Wait()
Expand Down

0 comments on commit 7bbcc76

Please sign in to comment.