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

With the default ZConnectionPoolConfig if the connection fails, it'll retry forever to try to connect and will deadlock the program #174

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

guizmaii
Copy link
Member

No description provided.

…ll retry forever to connect and deadlock the program
@guizmaii guizmaii changed the title With the default ZConnectionPoolConfig if the connection fails, it'll retry forever to connect and deadlock the program With the default ZConnectionPoolConfig if the connection fails, it'll retry forever to try to connect and will deadlock the program Oct 27, 2023
@@ -32,7 +32,8 @@ object ZConnectionPoolConfig {

lazy val default: ZConnectionPoolConfig = ZConnectionPoolConfig(8, 32, defaultRetryPolicy, 300.seconds)

lazy val defaultRetryPolicy: Schedule.WithState[Long, Any, Any, Duration] = Schedule.exponential(10.millis)
lazy val defaultRetryPolicy: Schedule.WithState[(Long, Long), Any, Any, (Long, Duration)] =
Schedule.recurs(10) && Schedule.exponential(15.millis)
Copy link
Member Author

Choose a reason for hiding this comment

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

Why 10 and 15.millis here? Because if my math is correct, it'll make the user wait for max 30 seconds.

See https://scastie.scala-lang.org/HnnTNtrRRaGlrsE8cxbajA

@adamgfraser adamgfraser merged commit 6667473 into zio:main Oct 27, 2023
15 checks passed
@guizmaii guizmaii deleted the fix_forever_hang branch October 27, 2023 16:22
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.

2 participants