Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConcurrentMessages issue in setDelay() #84

Open
lingjshi opened this issue Sep 23, 2021 · 0 comments
Open

ConcurrentMessages issue in setDelay() #84

lingjshi opened this issue Sep 23, 2021 · 0 comments

Comments

@lingjshi
Copy link

  1. https://github.com/william20111/go-thousandeyes/blob/850c5703d1939f3d037a9757a8dd06581eeb4b5c/client.go#L246

We need to handle the case that the ConcurrentMessages list consists of all the past messages.

for i, t := range rate.ConcurrentMessages {
	if t.Sub(now) >= time.Duration(0) {
		rate.ConcurrentMessages = rate.ConcurrentMessages[i:]
		break
	}
        // Need to clear the list if it consists all the past messages, otherwise the delay will be increased for each incoming request.
	if i == (len(rate.ConcurrentMessages) -1) {
		rate.ConcurrentMessages = rate.ConcurrentMessages[:0]
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant