docspell icon indicating copy to clipboard operation
docspell copied to clipboard

Allow configuration of hikari pool size

Open jjkrone opened this issue 2 months ago • 8 comments

This PR adds the option so specify the maximum pool size of db connections. Right now, the default by doobie of connection pool of 10 is being used, which can be too little in some multi user envoirments. Result: you now can specifiy in the config file e.g. `jdbc {maximum-pool-size = 20}``

jjkrone avatar Oct 14 '25 14:10 jjkrone

Thank you @jjkrone! I was quite surprised that I didn't add a pool size option from the beginning! 😅 It would be nice if it is also supported in the configuration. Let me know if you like to do it? I think you would need to update the reference.conf files with the corresponding setting. The camel-case needs to be converted to snake case, so it would be maximum-pool-size, I suppose.

eikek avatar Oct 22 '25 11:10 eikek

on another note: you can run sbt fix to fix the source code formatting

eikek avatar Oct 22 '25 11:10 eikek

Correct, my PR adds support for this style of configuration. (Tested locally with docker)

jdbc {
    # The JDBC url to the database. By default a H2 file-based
    # database is configured. You can provide a postgresql or
    # mariadb connection here. When using H2 use the PostgreSQL
    # compatibility mode and AUTO_SERVER feature.
      url = "jdbc:postgresql://db:5432/dbname"
      user = "dbuser"
      password = "dbpass"
      maximum-pool-size = 20
  }

jjkrone avatar Oct 22 '25 11:10 jjkrone

I think this setting is missing from the reference.conf files that provide all default values. It would be nice if they also show this new setting. Then the default argument can be removed from the JdbcConfig constructor.

eikek avatar Oct 22 '25 11:10 eikek

Ah! Now I get what you mean. The reason why I added it for the Constructor was backwards compatibility, but sure using reference.conf is better. Will do a change later, once I've verified in my local build.

Also: I think 10 is a very low default value, should we increase it by default?

jjkrone avatar Oct 22 '25 12:10 jjkrone

Thank you! Ah yes, good thought about backwards compat, but this is not a library and so I don't care really (for the scala api anyways, it's different for the http api…). The reference.conf hold the default values and the environment variables config is also using this as a reference for which variables to look for.

eikek avatar Oct 22 '25 18:10 eikek

Also: I think 10 is a very low default value, should we increase it by default?

I would leave it to 10, as it is now. Normally, this is enough and now people can change it.

eikek avatar Oct 25 '25 15:10 eikek

Ok I added it to the default value to the reference.conf. Since the tests do not read from reference.conf, it was neccessary to add the default value of 10 to the tests.

jjkrone avatar Oct 29 '25 22:10 jjkrone