Skip to content

Commit

Permalink
fix: CANNOT connet to Redis with special password #2893 (#2894)
Browse files Browse the repository at this point in the history
Co-authored-by: karlhjm <[email protected]>
  • Loading branch information
karlhjm and karlhjm authored Nov 22, 2023
1 parent 18c28a7 commit 21c19a9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/job/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"encoding/json"
"errors"
"fmt"
"net/url"
"reflect"
"strings"
"time"
Expand Down Expand Up @@ -64,9 +65,9 @@ func New(cfg *Config, queue Queue) (*Job, error) {
}

server, err := machinery.NewServer(&machineryv1config.Config{
Broker: fmt.Sprintf("redis://%s@%s/%d", cfg.Password, strings.Join(cfg.Addrs, ","), cfg.BrokerDB),
Broker: fmt.Sprintf("redis://%s@%s/%d", url.QueryEscape(cfg.Password), strings.Join(cfg.Addrs, ","), cfg.BrokerDB),
DefaultQueue: queue.String(),
ResultBackend: fmt.Sprintf("redis://%s@%s/%d", cfg.Password, strings.Join(cfg.Addrs, ","), cfg.BackendDB),
ResultBackend: fmt.Sprintf("redis://%s@%s/%d", url.QueryEscape(cfg.Password), strings.Join(cfg.Addrs, ","), cfg.BackendDB),
ResultsExpireIn: DefaultResultsExpireIn,
Redis: &machineryv1config.RedisConfig{
MasterName: cfg.MasterName,
Expand Down

0 comments on commit 21c19a9

Please sign in to comment.