mirror of
https://github.com/bitmagnet-io/bitmagnet.git
synced 2026-07-22 04:05:17 -04:00
27 lines
491 B
Go
27 lines
491 B
Go
package client
|
|
|
|
import (
|
|
"github.com/bitmagnet-io/bitmagnet/internal/boilerplate/lazy"
|
|
"github.com/bitmagnet-io/bitmagnet/internal/queue/redis"
|
|
"github.com/hibiken/asynq"
|
|
"go.uber.org/fx"
|
|
)
|
|
|
|
type Params struct {
|
|
fx.In
|
|
Redis lazy.Lazy[*redis.Client]
|
|
}
|
|
|
|
type Result struct {
|
|
fx.Out
|
|
Client lazy.Lazy[*asynq.Client]
|
|
}
|
|
|
|
func New(p Params) Result {
|
|
return Result{
|
|
Client: lazy.New(func() (*asynq.Client, error) {
|
|
return asynq.NewClient(redis.Wrapper{Redis: p.Redis}), nil
|
|
}),
|
|
}
|
|
}
|