2
0
mirror of https://github.com/hibiken/asynq.git synced 2026-01-31 06:26:59 +00:00
Files
asynq/asynq.go

48 lines
1.2 KiB
Go
Raw Normal View History

2019-11-14 21:07:19 -08:00
package asynq
2019-12-03 21:01:26 -08:00
import "github.com/go-redis/redis/v7"
2019-11-22 06:16:43 -08:00
2019-11-16 14:45:51 -08:00
/*
TODOs:
- [P0] asynqmon del <taskID>, asynqmon delall <qname>
- [P0] asynqmon kill <taskID>, asynqmon killall <qname>
2019-12-11 19:56:19 -08:00
- [P0] Test refactor - helpers to initialize queues and read queue contents
- [P0] Redis Memory Usage, Connection info in stats
- [P0] Processed, Failed count for today
2019-12-07 20:25:46 -08:00
- [P0] Go docs + CONTRIBUTION.md + Github issue template
- [P0] Redis Sentinel support
2019-11-23 16:44:22 -08:00
- [P1] Add Support for multiple queues and priority
2019-11-17 15:36:33 -08:00
- [P1] User defined max-retry count
2019-11-16 14:45:51 -08:00
*/
// Max retry count by default
2019-12-10 21:38:25 -08:00
const defaultMaxRetry = 25
2019-11-14 21:07:19 -08:00
// Task represents a task to be performed.
type Task struct {
2019-11-16 14: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-14 21:07:19 -08:00
}
2019-12-03 19:43:01 -08:00
// RedisConfig specifies redis configurations.
2019-12-09 06:52:43 -08:00
// TODO(hibiken): Support more configuration.
2019-12-03 19:43:01 -08:00
type RedisConfig struct {
2019-11-14 21:07:19 -08:00
Addr string
Password string
// DB specifies which redis database to select.
DB int
2019-11-14 21:07:19 -08:00
}
2019-12-01 07:59:52 -08:00
2019-12-09 06:22:08 -08:00
func newRedisClient(cfg *RedisConfig) *redis.Client {
2019-12-03 21:01:26 -08:00
return redis.NewClient(&redis.Options{
2019-12-09 06:22:08 -08:00
Addr: cfg.Addr,
Password: cfg.Password,
DB: cfg.DB,
2019-12-03 21:01:26 -08:00
})
2019-12-02 06:55:04 -08:00
}