From 7eebbf181ed841376300bede0395610112bf1e78 Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Wed, 24 Jun 2020 05:42:06 -0700 Subject: [PATCH] Update docs --- CHANGELOG.md | 7 +++++++ client.go | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33aecb8..c3942fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- All tasks now requires timeout or deadline. By default, timeout is set to 30 mins. +- Tasks that exceed its deadline are automatically retried. +- Encoding schema for task message has changed. Please install the lastest CLI and run `migrate` command if + you have tasks enqueued by the previous version of asynq. + ## [0.9.4] - 2020-06-13 ### Fixed diff --git a/client.go b/client.go index d93bf93..2492633 100644 --- a/client.go +++ b/client.go @@ -69,13 +69,23 @@ func Queue(name string) Option { } // Timeout returns an option to specify how long a task may run. +// If the timeout elapses before the Handler returns, then the task +// will be retried. // // Zero duration means no limit. +// +// If there's a conflicting Deadline option, whichever comes earliest +// will be used. func Timeout(d time.Duration) Option { return timeoutOption(d) } // Deadline returns an option to specify the deadline for the given task. +// If it reaches the deadline before the Handler returns, then the task +// will be retried. +// +// If there's a conflicting Timeout option, whichever comes earliest +// will be used. func Deadline(t time.Time) Option { return deadlineOption(t) } @@ -196,6 +206,7 @@ func (c *Client) SetDefaultOptions(taskType string, opts ...Option) { // // The argument opts specifies the behavior of task processing. // If there are conflicting Option values the last one overrides others. +// By deafult, max retry is set to 25 and timeout is set to 30 minutes. func (c *Client) EnqueueAt(t time.Time, task *Task, opts ...Option) error { return c.enqueueAt(t, task, opts...) } @@ -206,6 +217,7 @@ func (c *Client) EnqueueAt(t time.Time, task *Task, opts ...Option) error { // // The argument opts specifies the behavior of task processing. // If there are conflicting Option values the last one overrides others. +// By deafult, max retry is set to 25 and timeout is set to 30 minutes. func (c *Client) Enqueue(task *Task, opts ...Option) error { return c.enqueueAt(time.Now(), task, opts...) } @@ -216,6 +228,7 @@ func (c *Client) Enqueue(task *Task, opts ...Option) error { // // The argument opts specifies the behavior of task processing. // If there are conflicting Option values the last one overrides others. +// By deafult, max retry is set to 25 and timeout is set to 30 minutes. func (c *Client) EnqueueIn(d time.Duration, task *Task, opts ...Option) error { return c.enqueueAt(time.Now().Add(d), task, opts...) }