https://sonarly.com/issue/38297?type=bug
Message import jobs can fail during participant matching with `QueryRunnerAlreadyReleasedError`, interrupting Gmail sync for affected workspaces.
Fix: Implemented the transactional fix in `MessagingMessageParticipantService` to prevent participant matching from running through a nested `executeInWorkspaceContext` when an existing `transactionManager` is already provided.
What changed:
- Refactored `saveMessageParticipants()` to:
- execute repository reads/inserts using the provided `transactionManager` when present,
- run matching in the same path,
- only use `executeInWorkspaceContext` when no transaction manager is provided.
- Also ensured the initial deduplication `find(...)` uses the same `transactionManager` for consistency with insert/match operations.
Why this addresses the root cause:
- The failing path mixed nested workspace context + inherited transaction manager usage.
- This change keeps the operation aligned with the active transactional boundary from the caller, removing the fragile manager lifecycle crossing that led to `QueryRunnerAlreadyReleasedError`.
Authored by Sonarly by autonomous analysis (run 43706).