-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9654 from kobergj/FixRegistryTTL
Fix issues with natsjskv registry
- Loading branch information
Showing
8 changed files
with
74 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package registry | ||
|
||
import ( | ||
"os" | ||
"time" | ||
) | ||
|
||
const ( | ||
_registryRegisterIntervalEnv = "EXPERIMENTAL_REGISTER_INTERVAL" | ||
_registryRegisterTTLEnv = "EXPERIMENTAL_REGISTER_TTL" | ||
|
||
// Note: _defaultRegisterInterval should always be lower than _defaultRegisterTTL | ||
_defaultRegisterInterval = time.Second * 25 | ||
_defaultRegisterTTL = time.Second * 30 | ||
) | ||
|
||
// GetRegisterInterval returns the register interval from the environment. | ||
func GetRegisterInterval() time.Duration { | ||
d, err := time.ParseDuration(os.Getenv(_registryRegisterIntervalEnv)) | ||
if err != nil { | ||
return _defaultRegisterInterval | ||
} | ||
return d | ||
} | ||
|
||
// GetRegisterTTL returns the register TTL from the environment. | ||
func GetRegisterTTL() time.Duration { | ||
d, err := time.ParseDuration(os.Getenv(_registryRegisterTTLEnv)) | ||
if err != nil { | ||
return _defaultRegisterTTL | ||
} | ||
return d | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters