[spike / WIP] TMMM-237: Close JPA session early#1825
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
This spike attempts to release JPA resources earlier in request handling so long-running external work (HTTP proxying / GeoTools feature counting & extract generation) doesn’t keep a JPA session/transaction open longer than needed.
Changes:
- Injected
EntityManagerintoLayerExtractControllerandGeoServiceProxyController. - Changed
LayerExtractController#extractto@Transactional(readOnly = true). - Added
entityManager.close()calls in both controllers after validation steps.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/main/java/org/tailormap/api/controller/LayerExtractController.java | Attempts to close the JPA session mid-request during extract request processing. |
| src/main/java/org/tailormap/api/controller/GeoServiceProxyController.java | Attempts to close the JPA session before proxying outbound requests/streaming responses. |
| // after all validations we can close the JPA session | ||
| this.entityManager.close(); | ||
|
|
| // after all validations we can close the JPA session | ||
| this.entityManager.close(); | ||
|
|
| // after all validations we can close the JPA session | ||
| this.entityManager.close(); | ||
|
|
❌ 1 Tests Failed:
View the full list of 1 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
Test Results639 tests ±0 637 ✅ ±0 9m 48s ⏱️ - 1m 2s For more details on these failures, see this check. Results for commit 046f570. ± Comparison against base commit ce03f21. ♻️ This comment has been updated with latest results. |
don't wait for the external resource transaction (http / jdbc) to complete before closing the JPA session/transaction
59c4664 to
046f570
Compare
Don't wait for the external "resource transaction" (HTTP [proxy] / JDBC [extract]) to complete before closing the JPA session/transaction