fix: add random wait value
[skip ci]
This commit is contained in:
parent
d1267260cb
commit
c1f463935b
1 changed files with 23 additions and 4 deletions
|
|
@ -2,10 +2,11 @@ package postgresflexalpha
|
|||
|
||||
import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand/v2"
|
||||
"math/big"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
|
@ -142,7 +143,13 @@ func CreateInstanceWaitHandler(
|
|||
"failedCount": failedCount,
|
||||
},
|
||||
)
|
||||
time.Sleep(time.Duration(rand.IntN(120)) * time.Second) //nolint:gosec // not that important and temporary
|
||||
var waitCounter int64 = 1
|
||||
maxWait := big.NewInt(7)
|
||||
n, err := rand.Int(rand.Reader, maxWait)
|
||||
if err == nil {
|
||||
waitCounter = n.Int64() + 1
|
||||
}
|
||||
time.Sleep(time.Duration(waitCounter*30) * time.Second) //nolint:gosec // not that important and temporary
|
||||
return false, nil, nil
|
||||
}
|
||||
return true, s, fmt.Errorf(
|
||||
|
|
@ -218,7 +225,13 @@ func PartialUpdateInstanceWaitHandler(
|
|||
"failedCount": failedCount,
|
||||
},
|
||||
)
|
||||
time.Sleep(time.Duration(rand.IntN(120)) * time.Second) //nolint:gosec // not that important and temporary
|
||||
var waitCounter int64 = 1
|
||||
maxWait := big.NewInt(7)
|
||||
n, err := rand.Int(rand.Reader, maxWait)
|
||||
if err == nil {
|
||||
waitCounter = n.Int64() + 1
|
||||
}
|
||||
time.Sleep(time.Duration(waitCounter*30) * time.Second) //nolint:gosec // not that important and temporary
|
||||
return false, nil, nil
|
||||
}
|
||||
return true, s, fmt.Errorf(
|
||||
|
|
@ -352,7 +365,13 @@ func DeleteInstanceWaitHandler(
|
|||
"failedCount": failedCount,
|
||||
},
|
||||
)
|
||||
time.Sleep(time.Duration(rand.IntN(120)) * time.Second) //nolint:gosec // not that important and temporary
|
||||
var waitCounter int64 = 1
|
||||
maxWait := big.NewInt(7)
|
||||
n, err := rand.Int(rand.Reader, maxWait)
|
||||
if err == nil {
|
||||
waitCounter = n.Int64() + 1
|
||||
}
|
||||
time.Sleep(time.Duration(waitCounter*30) * time.Second) //nolint:gosec // not that important and temporary
|
||||
return false, nil, nil
|
||||
}
|
||||
return true, nil, fmt.Errorf("wait handler got status FAILURE for instance: %s", instanceID)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue