2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-12-25 23:32:17 +08:00
asynq/asynq.go

42 lines
875 B
Go
Raw Normal View History

2019-11-15 13:07:19 +08:00
package asynq
2019-12-04 13:01:26 +08:00
import "github.com/go-redis/redis/v7"
2019-11-22 22:16:43 +08:00
2019-11-17 06:45:51 +08:00
/*
TODOs:
2019-12-01 01:38:46 +08:00
- [P0] Go docs + CONTRIBUTION.md
2019-11-24 08:44:22 +08:00
- [P1] Add Support for multiple queues and priority
2019-11-18 07:36:33 +08:00
- [P1] User defined max-retry count
- [P2] Web UI
2019-11-17 06:45:51 +08:00
*/
// Max retry count by default
const defaultMaxRetry = 25
2019-11-15 13:07:19 +08:00
// Task represents a task to be performed.
type Task struct {
2019-11-17 06:45:51 +08:00
// Type indicates the kind of the task to be performed.
Type string
// Payload is an arbitrary data needed for task execution.
// The value has to be serializable.
Payload map[string]interface{}
2019-11-15 13:07:19 +08:00
}
2019-12-04 11:43:01 +08:00
// RedisConfig specifies redis configurations.
type RedisConfig struct {
2019-11-15 13:07:19 +08:00
Addr string
Password string
// DB specifies which redis database to select.
DB int
2019-11-15 13:07:19 +08:00
}
2019-12-01 23:59:52 +08:00
2019-12-04 13:01:26 +08:00
func newRedisClient(config *RedisConfig) *redis.Client {
return redis.NewClient(&redis.Options{
Addr: config.Addr,
Password: config.Password,
DB: config.DB,
})
2019-12-02 22:55:04 +08:00
}