Skip to content

fix(core): fix connection pool eviction and exception wrapping in SQLite and MySQL (#332) - #336

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/332-fix-connection-pools
Jul 12, 2026
Merged

fix(core): fix connection pool eviction and exception wrapping in SQLite and MySQL (#332)#336
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/332-fix-connection-pools

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Что сделано

  • SqliteConnectionPool: исправлено вытеснение слотов в _evictIfNeededBeforeNewSlot(). При исчерпании лимита maxEntries и отсутствии свободных (refs == 0) слотов теперь выбрасывается понятное исключение StateError('SQLite connection pool exhausted: $maxEntries slots in use.'), а не происходит бесконечное добавление соединений поверх лимита. Добавлена отмена таймеров idleTimer при удалении/вытеснении и использование асинхронного unawaited(connection.forceClose()).
  • MysqlConnectionPool: создание соединений в acquire() обернуто в try/catch с пробросом специализированного исключения MysqlConnectionException и сохранением стека вызовов (Error.throwWithStackTrace), как в пуле PostgreSQL.
  • Исключения: добавлены классы SqliteConnectionException и MysqlConnectionException в соответствующие модули соединений.
  • Новые unit-тесты: созданы sqlite_connection_pool_test.dart и mysql_connection_pool_test.dart со 100% покрытием логики пулов.

Как проверялось

  • flutter analyze — 0 проблем.
  • flutter test — 822 из 822 тестов успешно пройдено.

Closes #332

@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 662bb4e into dev Jul 12, 2026
4 checks passed
@ZhuchkaTriplesix ZhuchkaTriplesix self-assigned this Jul 12, 2026
ZhuchkaTriplesix added a commit that referenced this pull request Jul 27, 2026
fix(core): fix connection pool eviction and exception wrapping in SQLite and MySQL (#332)
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the issue/332-fix-connection-pools branch July 27, 2026 20:06
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.

1 participant