feat: optimize job new in internal (#2341)
Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
parent
602206495a
commit
b80b4acbe4
|
|
@ -53,16 +53,6 @@ func New(cfg *Config, queue Queue) (*Job, error) {
|
|||
// Set logger
|
||||
machineryv1log.Set(&MachineryLogger{})
|
||||
|
||||
if err := ping(&redis.UniversalOptions{
|
||||
Addrs: cfg.Addrs,
|
||||
MasterName: cfg.MasterName,
|
||||
Username: cfg.Username,
|
||||
Password: cfg.Password,
|
||||
DB: cfg.BrokerDB,
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := ping(&redis.UniversalOptions{
|
||||
Addrs: cfg.Addrs,
|
||||
MasterName: cfg.MasterName,
|
||||
|
|
@ -98,8 +88,7 @@ func New(cfg *Config, queue Queue) (*Job, error) {
|
|||
}
|
||||
|
||||
func ping(options *redis.UniversalOptions) error {
|
||||
client := redis.NewUniversalClient(options)
|
||||
return client.Ping(context.Background()).Err()
|
||||
return redis.NewUniversalClient(options).Ping(context.Background()).Err()
|
||||
}
|
||||
|
||||
func (t *Job) RegisterJob(namedJobFuncs map[string]any) error {
|
||||
|
|
|
|||
Loading…
Reference in New Issue