Update exported package API docs

This commit is contained in:
Ken Hibino
2019-12-06 22:00:09 -08:00
parent 46e84769b5
commit aa8a3b8aaa
3 changed files with 25 additions and 6 deletions

View File

@@ -7,18 +7,26 @@ import (
"github.com/hibiken/asynq/internal/rdb"
)
// Client is an interface for scheduling tasks.
// A Client is responsible for scheduling tasks.
//
// A Client is used to register task that should be processed
// immediately or some time in the future.
//
// Clients are safe for concurrent use by multiple goroutines.
type Client struct {
rdb *rdb.RDB
}
// NewClient creates and returns a new client.
// NewClient and returns a new Client given a redis configuration.
func NewClient(config *RedisConfig) *Client {
r := rdb.NewRDB(newRedisClient(config))
return &Client{r}
}
// Process enqueues the task to be performed at a given time.
// Process registers a task to be processed at the specified time.
//
// Process returns nil if the task was registered successfully,
// otherwise returns non-nil error.
func (c *Client) Process(task *Task, processAt time.Time) error {
msg := &rdb.TaskMessage{
ID: uuid.New(),