mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Reduce client connection attempts to test engine status (tests)
200 -> 16 Previously, considering the fibonacci back off strategy, if engine failed to start it would have tried to attempt connections for 2.862799e+33 years. Now, the amount of attempts is 16, equivalent to around 2 and a half seconds. Should be more than enough, considering that usually 6-7 attempts are enough.
This commit is contained in:
committed by
Dan Christian Bogos
parent
f1d0be170d
commit
c32de12cee
@@ -346,7 +346,7 @@ func StartEngine(cfgPath string, waitEngine int) (*exec.Cmd, error) {
|
||||
}
|
||||
fib := utils.FibDuration(time.Millisecond, 0)
|
||||
var connected bool
|
||||
for i := 0; i < 200; i++ {
|
||||
for i := 0; i < 16; i++ {
|
||||
time.Sleep(fib())
|
||||
if _, err := jsonrpc.Dial(utils.TCP, cfg.ListenCfg().RPCJSONListen); err != nil {
|
||||
utils.Logger.Warning(fmt.Sprintf("Error <%s> when opening test connection to: <%s>",
|
||||
@@ -374,7 +374,7 @@ func StartEngineWithContext(ctx context.Context, cfgPath string, waitEngine int)
|
||||
return
|
||||
}
|
||||
fib := utils.FibDuration(time.Millisecond, 0)
|
||||
for i := 0; i < 200; i++ {
|
||||
for i := 0; i < 16; i++ {
|
||||
time.Sleep(fib())
|
||||
if _, err = jsonrpc.Dial(utils.TCP, cfg.ListenCfg().RPCJSONListen); err != nil {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user