Skip to content

Commit

Permalink
fix subscribe from registry
Browse files Browse the repository at this point in the history
  • Loading branch information
1kasa committed Feb 6, 2025
1 parent bb9273d commit 2c799e2
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions registry/directory/directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,20 @@ func (dir *RegistryDirectory) Subscribe(url *common.URL) error {
registerUrl := dir.registry.GetURL()

var timeoutStr string
if registerUrl == nil {
timeoutStr = url.GetParam(constant.TimeoutKey, "1s")
} else {
timeoutStr = registerUrl.GetParam(constant.RegistryTimeoutKey, "")

if registerUrl != nil {
if val := registerUrl.GetParam(constant.RegistryTimeoutKey, ""); val != "" {
timeoutStr = val
}
}
timeout, _ := time.ParseDuration(timeoutStr)

timeout, err := time.ParseDuration(timeoutStr)
if err != nil {
logger.Warnf("Invalid timeout value %s, using default %s", timeoutStr, constant.DefaultRegTimeout)
timeout, _ = time.ParseDuration(constant.DefaultRegTimeout)
}

fmt.Println("timeout:\n\n", timeout)

done := make(chan struct{})

Expand Down

0 comments on commit 2c799e2

Please sign in to comment.