feat: added a new field in settings screen, regarding maxConnection c…
An open-source desktop client for modern databases.
Status: Beta
Brought to you by:
debba92
Originally created by: ealvesss
PR Description
feat: make connection pool size configurable via Settings
Problem
The maximum number of database connections per pool was hardcoded in pool_manager.rs (10 for MySQL/PostgreSQL, 5 for SQLite), with no way for users to adjust it.
Changes
Backend (src-tauri/src/)
Frontend (src/)
Behavior
Originally posted by: kilo-code-bot[bot]
Code Review Summary
Status: 2 Issues Found | Recommendation: Address before merge
Overview
Issue Details (click to expand)
#### CRITICAL | File | Line | Issue | |------|------|-------| | `src-tauri/src/config.rs` | 145 | Duplicate `if config.plugins.is_some()` block - identical code exists on lines 141-143 | | `src/components/ui/NewConnectionModal.tsx` | 341 | Logic bug: setFormData unconditionally overwrites preserved form data, making driver-specific preservation ineffective |Files Reviewed (11 files)
- `package-lock.json` - Generated file, skipped - `src-tauri/Cargo.lock` - Generated file, skipped - `src-tauri/src/commands.rs` - Pool invalidation on connection update - `src-tauri/src/config.rs` - Added DEFAULT_MAX_CONNECTIONS constant; has duplicate code issue - `src-tauri/src/models.rs` - Added max_connections field to ConnectionParams - `src-tauri/src/pool_manager.rs` - Configurable max_connections for MySQL/PostgreSQL pools - `src/components/ui/NewConnectionModal.tsx` - Added max_connections UI and driver-specific form preservation; has logic bug - `src/i18n/config.ts` - Formatting changes only - `src/i18n/locales/en.json` - Added translations for max connections - `src/i18n/locales/es.json` - Added translations for max connections - `src/i18n/locales/it.json` - Added translations for max connections - `src/i18n/locales/pt-br.json` - Empty file added - `src/pages/Connections.tsx` - Added key prop to NewConnectionModal - `src/pages/Settings.tsx` - Whitespace change only - `src/utils/connections.ts` - Added max_connections field to interfaceFix these issues in Kilo Cloud
Originally posted by: debba
@ealvesss Thanks for the contribution! The feature is well-structured overall, but there are a few issues to address before merging.
I have 2 points I would change:
1) DEFAULT_MAX_CONNECTIONS = 1
is a regression** — the previous hardcoded values were10for MySQL/PostgreSQL and5for SQLite. Defaulting to1` will serialize all queries and cause significant performance degradation for users who haven't explicitly configured the setting.2) SQLite needs a separate cap — SQLite only supports one concurrent writer, so high pool values will cause
SQLITE_BUSY/database is lockederrors. It should be capped independently (e.g.params.max_connections.map(|v| v.min(5)).unwrap_or(5)), not share the same configurable value as MySQL/PostgreSQL.Design suggestion
Rather than a global setting in the Settings page, consider moving
max_connectionsto the individual connection configuration (ConnectionParams). This would allow users to set:max_connections: 1for a PostgreSQL connection behind pgBouncermax_connections: 10for a direct MySQL connectionThis approach is more flexible, more explicit, and makes the global
AppConfigchange unnecessary — which would simplify the diff considerably.What do you think?
Originally posted by: ealvesss
@debba the "code-review" bots run again, after change the MR?
Originally posted by: debba
@ealvesss Yes.
Btw I cannot run the project because I have the following issues:
error[E0382]: borrow of moved value:
config.plugins--> src/config.rs:145:12
|
142 | existing_config.plugins = config.plugins;
| -------------- value moved here
...
145 | if config.plugins.is_some() {
| ^^^^^^^^^^^^^^ value borrowed here after move
|
= note: move occurs because
config.pluginshas typestd::option::Option<HashMap<std::string::String, config::PluginConfig>>, which does not implement theCopytraitFor more information about this error, try
rustc --explain E0382.error: could not compile
tabularis(lib) due to 1 previous errorOriginally posted by: ealvesss
here i can run properly.
how can I reproduce this error?
Originally posted by: debba
@ealvesss sent the bug, if you can fix it and resolve conflicts, I will approve the pull request
Originally posted by: ealvesss
I will do it soon. Probably tomorrow!