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

conn-max-age setting has no affect?? #4017

Open
alexjfisher opened this issue Dec 2, 2024 · 1 comment
Open

conn-max-age setting has no affect?? #4017

alexjfisher opened this issue Dec 2, 2024 · 1 comment

Comments

@alexjfisher
Copy link

alexjfisher commented Dec 2, 2024

The conn-max-age setting is described in the PuppetDB docs as

The maximum time (in minutes), for a pooled connection to remain unused before it is closed off.

In the code it is used, (under some condition at least), to set the connection pool's IdleTimeout

(when (and conn-max-age-ms conn-lifetime-ms (> conn-max-age-ms conn-lifetime-ms))
(some->> conn-max-age-ms (.setIdleTimeout config)))

According to the HikariCP documentation on IdleTimeout

This setting only applies when minimumIdle is defined to be less than maximumPoolSize.

and since there is no mechanism in PuppetDB to set minimumIdle (the minimum number of idle connections that HikariCP tries to maintain in the pool), and this setting is not set to anything by PuppetDB and in HikariCP defaults to the same as maximumPoolSize

Default: same as maximumPoolSize

I suggest that conn-max-age is redundant as it does nothing. But maybe I've misread the code somewhere.

@alexjfisher
Copy link
Author

oh dear, it does have an affect, but only because of a bug elsewhere. In converting minutes to milliseconds, two settings are swapped here...

(let [conn-lifetime-ms (some-> conn-max-age pl-time/to-millis)
conn-max-age-ms (some-> conn-lifetime pl-time/to-millis)
config (HikariConfig.)]

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