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

Fix ExponentialReconnectionPolicy not incrementing correctly #1374

Merged
merged 1 commit into from Nov 26, 2019
Merged

Fix ExponentialReconnectionPolicy not incrementing correctly #1374

merged 1 commit into from Nov 26, 2019

Conversation

bahadir
Copy link
Contributor

@bahadir bahadir commented Nov 22, 2019

ExponentialReconnectionPolicy doesn't honor the number of retries made, since it uses the wrong argument for the attempt count.

Test code:

package main

import (
	"fmt"
	"github.com/gocql/gocql"
)

func main() {
	policy := gocql.ExponentialReconnectionPolicy{
		MaxRetries: 10,
	}

	for index := 0; index < 10; index++ {
		fmt.Println(policy.GetInterval(index))
	}
}

Before changes:

51.210466028s
51.244050908s
51.216456005s
51.193771418s
51.192463749s
51.218682307s
51.156563701s
51.165651925s
51.159696951s
51.180091186s

After changes:

60.466028ms
144.050908ms
216.456005ms
393.771418ms
792.463749ms
1.618682307s
3.156563701s
6.365651925s
12.759696951s
25.580091186s

ExponentialReconnectionPolicy doesn't honor the number of retries made, since it uses the wrong argument for the attempt count.
@bahadir bahadir marked this pull request as ready for review November 22, 2019 10:06
Copy link
Contributor

@martin-sucha martin-sucha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good to me. I don't have write access to this repo, so we need to wait for one of the maintainers to merge it though.

Copy link
Member

@alourie alourie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! Thanks!

@alourie alourie merged commit 1982a06 into gocql:master Nov 26, 2019
martin-sucha pushed a commit to kiwicom/gocql that referenced this pull request Dec 16, 2019
)

ExponentialReconnectionPolicy doesn't honor the number of retries made, since it uses the wrong argument for the attempt count.
martin-sucha added a commit to kiwicom/gocql that referenced this pull request Feb 5, 2020
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

Successfully merging this pull request may close these issues.

None yet

3 participants