Repository navigation
fix(datasources): refresh cached pools after persisted connection changes - #78
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When another server process edits a datasource connection, getActivePool/getActivePoolAsync reread persisted status but reuse the old pool solely by datasource code. Subsequent queries can keep using the old host, database or credentials until this process restarts.
Track the connection settings used to create each pool in a WeakMap. Reuse a pool only when datasource ID/type/host/port/database/user/encrypted password/options still match. Retire changed pools through the existing closePool path and recreate from the current persisted row. Name-only edits, connection-test updates and options key-order changes preserve reuse. Disabled-source checks and async repository selection remain in place.
Validation: reproduced stale-host reuse on sync and async paths before the fix;57 lifecycle/disabled-source/dialect tests pass afterward.16 new tests cover all seven connection fields on both paths and non-connection edits. Independent review found no blocking issues and independently ran31 lifecycle tests plus factory-failure/retry and ID-change probes. No baseline changes; datasourcePool.js now below its existing size limit.
Current main5385ed3 also has an invalid architecture-baseline JSON file (separate fix#77) and unrelated test failures. CI is not claimed green; full-suite comparison details will be added after verification. Live MySQL/PostgreSQL/Docker acceptance is delegated to the PR checks.
中文:修复其他进程修改数据源后本进程继续复用旧连接池的问题,保留禁用拦截与正常缓存复用。
Full-suite comparison against unchanged main5385ed3 (node --test --test-force-exit used to obtain diagnostics despite leaked test resources): main732 passed,5 failed,14 skipped; this PR748 passed,5 failed,14 skipped. The failure names match exactly; the16 added tests pass. Existing failures cover model defaults, semantic confirmation, a rewritten error message, an undefined FakeIndicatorClient fixture and baseline parsing. These are not counted as passes. Both Docker matrices, PostgreSQL and MySQL persistence acceptance have passed on the PR; the full test job remains pending/blocked by inherited issues. No new test skips or baseline increases.
Latest combined candidate after V1.2.0 reconciliation:800 passed,16 skipped,5 failed (same failure names as unchanged main); architecture36 errors,2 warnings; fixture eval14/14 with2 pending judgments. The full test diagnostics used --test-force-exit because failed upstream tests retain resources; no failing or skipped tests were counted as passes. This is a scoped pool-cache fix, not a claim of full CI recovery.