lacre.repositories: Configure SQLAlchemy connection pooling #136

Merged
pfm merged 8 commits from connection-pooling into main 2024-01-04 19:52:04 +01:00

8 Commits

Author SHA1 Message Date
Piotr F. Mieszkowski 8f8f081d28 Fix key-removal condition, improve logging 2024-01-04 19:45:25 +01:00
Piotr F. Mieszkowski 07539a97d3 Improve logging
- Don't re-configure lacre.notify logger.
- Issue more DEBUG logs when deleting keys.
2023-12-20 23:03:04 +01:00
Piotr F. Mieszkowski 5c327b166a webgate-cron: Log more information, including exceptions 2023-12-19 18:21:00 +01:00
Piotr F. Mieszkowski 41b7535412 Add more logging, add --delete option to admin queue sub-command 2023-12-19 09:02:42 +01:00
Piotr F. Mieszkowski 9b5d578985 lacre.config: Make both enums case-insensitive
Also: use PGPStyle in lacre.core.
2023-12-17 20:42:57 +01:00
Piotr F. Mieszkowski ff429c93e6 Convert pooling parameters to integers 2023-12-17 14:12:52 +01:00
Piotr F. Mieszkowski 90da933bf9 Make disconnect handling configuration explicit
- Provide a new reuqired parameter: [database]pooling_mode and use it during
  SQLAlchemy engine initialisation.

- Update tests and configuration (including sample configuration).

- Adjust repository unit test to load config during setup.

- Pass an engine instance to repository constructors instead of connections.
  Engine keeps a connection pool and we rely on it.
2023-12-17 14:03:20 +01:00
Piotr F. Mieszkowski 86cc27e918 lacre.repositories: Configure SQLAlchemy connection pooling
Provide 3 new configuration parameters in database section:

- max_connection_age --- number of seconds before an idle connection is
  "recycled", i.e. replaced with a new one;

- pool_size --- number of simultaneous connections kept in the pool;

- max_overflow --- maximum number of simultaneous connections we could make to
  the database.

Update sample config, including links to documentation.
2023-12-16 23:32:27 +01:00