Skip to content

Commit

Permalink
Fix total time counting for PostRPCWithRetry
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Mar 30, 2022
1 parent 5d96081 commit abd4bf0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/utils/request_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func PostRPC(ctx context.Context, endpoint, method, params string) (data []byte,
func PostRPCWithRetry(ctx context.Context, endpoint, method, params string,
requestWait time.Duration) (data []byte, err error) {
try := 0
startTime := time.Now()
for {
try++

Expand All @@ -77,7 +78,7 @@ func PostRPCWithRetry(ctx context.Context, endpoint, method, params string,
continue
}

totalTime := time.Duration(try) * requestWait
totalTime := time.Since(startTime)
tryWord := "try"
if try > 1 {
tryWord = "tries"
Expand Down

0 comments on commit abd4bf0

Please sign in to comment.