NewQueue initializes a new Queue instance with the provided configuration. Parameters: - conf *config.Configuration: The configuration for the queue. Returns: - *Queue: A pointer to the newly created Queue instance.
(conf *config.Configuration, client *asynq.Client)
| 56 | // Returns: |
| 57 | // - *Queue: A pointer to the newly created Queue instance. |
| 58 | func NewQueue(conf *config.Configuration, client *asynq.Client) *Queue { |
| 59 | redisOption, err := redis_db.ParseRedisURL(conf.Redis.Dns, conf.Redis.SkipTLSVerify) |
| 60 | if err != nil { |
| 61 | logrus.WithError(err).Fatal("failed to parse Redis URL") |
| 62 | } |
| 63 | |
| 64 | queueOptions := asynq.RedisClientOpt{Addr: redisOption.Addr, Password: redisOption.Password, DB: redisOption.DB, TLSConfig: redisOption.TLSConfig, PoolSize: conf.Redis.PoolSize} |
| 65 | inspector := asynq.NewInspector(queueOptions) |
| 66 | return &Queue{ |
| 67 | Client: client, |
| 68 | Inspector: inspector, |
| 69 | config: conf, |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | // queueInflightExpiry enqueues a task to handle inflight expiry for a transaction. |
| 74 | // |