feat: optimize job new in internal (#2341)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2023-05-11 15:33:05 +08:00
parent 602206495a
commit b80b4acbe4
No known key found for this signature in database
GPG Key ID: 8B4E5D1290FA2FFB
1 changed files with 1 additions and 12 deletions

View File

@ -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 {