2021-10-18 07:16:42 +00:00
|
|
|
package queue
|
|
|
|
|
2022-08-10 10:17:34 +00:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/hibiken/asynq"
|
|
|
|
)
|
2022-02-16 10:47:57 +00:00
|
|
|
|
2021-10-18 07:16:42 +00:00
|
|
|
// Config ...
|
|
|
|
type Config struct {
|
|
|
|
// For message queue
|
2021-10-18 07:42:07 +00:00
|
|
|
Redis ConfigRedis
|
|
|
|
|
2021-10-18 07:16:42 +00:00
|
|
|
// Priority to process task, eg: Critical 6, Default 3, Low 1
|
|
|
|
// Using for server only
|
|
|
|
// https://github.com/hibiken/asynq/wiki/Queue-Priority
|
|
|
|
Concurrency int
|
2021-10-18 07:42:07 +00:00
|
|
|
Priority ConfigPriority
|
2024-07-08 08:36:17 +00:00
|
|
|
QueuePrefix string
|
2022-02-16 10:47:57 +00:00
|
|
|
|
2022-11-18 10:04:42 +00:00
|
|
|
TaskTimeout time.Duration
|
|
|
|
RetryDelayFunc asynq.RetryDelayFunc
|
|
|
|
ServerMiddlewares []asynq.MiddlewareFunc
|
2021-10-18 07:42:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ConfigRedis ...
|
|
|
|
type ConfigRedis struct {
|
|
|
|
URL string
|
|
|
|
Password string
|
|
|
|
}
|
|
|
|
|
|
|
|
// ConfigPriority ...
|
|
|
|
type ConfigPriority struct {
|
|
|
|
Critical int
|
|
|
|
Default int
|
|
|
|
Low int
|
|
|
|
StrictMode bool
|
2021-10-18 07:16:42 +00:00
|
|
|
}
|