mirror of
https://github.com/hibiken/asynq.git
synced 2024-11-10 11:31:58 +08:00
Reword doc comments
This commit is contained in:
parent
4df372b369
commit
45933eb6b0
6
doc.go
6
doc.go
@ -14,7 +14,7 @@ specify the options using one of RedisConnOpt types.
|
|||||||
DB: 3,
|
DB: 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
The Client is used to register a task to be processed at the specified time.
|
The Client is used to enqueue a task to be processed at the specified time.
|
||||||
|
|
||||||
Task is created with two parameters: its type and payload.
|
Task is created with two parameters: its type and payload.
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ Task is created with two parameters: its type and payload.
|
|||||||
// Enqueue the task to be processed immediately.
|
// Enqueue the task to be processed immediately.
|
||||||
err := client.Enqueue(t)
|
err := client.Enqueue(t)
|
||||||
|
|
||||||
// Schedule the task to be processed in one minute.
|
// Schedule the task to be processed after one minute.
|
||||||
err = client.EnqueueIn(time.Minute, t)
|
err = client.EnqueueIn(time.Minute, t)
|
||||||
|
|
||||||
The Server is used to run the background task processing with a given
|
The Server is used to run the background task processing with a given
|
||||||
@ -38,7 +38,7 @@ handler.
|
|||||||
|
|
||||||
srv.Run(handler)
|
srv.Run(handler)
|
||||||
|
|
||||||
Handler is an interface with one method ProcessTask which
|
Handler is an interface type with a method which
|
||||||
takes a task and returns an error. Handler should return nil if
|
takes a task and returns an error. Handler should return nil if
|
||||||
the processing is successful, otherwise return a non-nil error.
|
the processing is successful, otherwise return a non-nil error.
|
||||||
If handler panics or returns a non-nil error, the task will be retried in the future.
|
If handler panics or returns a non-nil error, the task will be retried in the future.
|
||||||
|
@ -258,7 +258,7 @@ var ErrServerStopped = errors.New("asynq: the server has been stopped")
|
|||||||
// a signal, it gracefully shuts down all active workers and other
|
// a signal, it gracefully shuts down all active workers and other
|
||||||
// goroutines to process the tasks.
|
// goroutines to process the tasks.
|
||||||
//
|
//
|
||||||
// Run returns any error encountered during server boot time.
|
// Run returns any error encountered during server startup time.
|
||||||
// If the server has already been stopped, ErrServerStopped is returned.
|
// If the server has already been stopped, ErrServerStopped is returned.
|
||||||
func (srv *Server) Run(handler Handler) error {
|
func (srv *Server) Run(handler Handler) error {
|
||||||
if err := srv.Start(handler); err != nil {
|
if err := srv.Start(handler); err != nil {
|
||||||
@ -274,7 +274,7 @@ func (srv *Server) Run(handler Handler) error {
|
|||||||
// Tasks are processed concurrently by the workers up to the number of
|
// Tasks are processed concurrently by the workers up to the number of
|
||||||
// concurrency specified at the initialization time.
|
// concurrency specified at the initialization time.
|
||||||
//
|
//
|
||||||
// Start returns any error encountered during server boot time.
|
// Start returns any error encountered during server startup time.
|
||||||
// If the server has already been stopped, ErrServerStopped is returned.
|
// If the server has already been stopped, ErrServerStopped is returned.
|
||||||
func (srv *Server) Start(handler Handler) error {
|
func (srv *Server) Start(handler Handler) error {
|
||||||
if handler == nil {
|
if handler == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user