pjfanning opened a new pull request, #493:
URL: https://github.com/apache/pekko-persistence-cassandra/pull/493

   > **Stacked on #492** — it needs `Reconciliation.close()`, so this PR's diff 
currently includes that commit. It will reduce to the `Cleanup` commit alone 
once #492 is merged.
   
   ### Motivation
   
   `Cleanup`'s tagged event operations lazily create a `Reconciliation`, which 
starts a system actor that stays alive for the lifetime of the `ActorSystem`. 
`Cleanup` is documented as a per-batch tool that can be run several times in 
parallel ("It's possible to parallelize the deletes by running several cleanup 
operations at the same time"), so every instance that deletes tagged events 
leaks one of those actors.
   
   ### Modification
   
   - Add `Cleanup.close()`, which closes the internal `Reconciliation`.
   - Track whether the lazily created `Reconciliation` exists, so that closing 
a `Cleanup` that never touched tagged events does not create one just to stop 
it again.
   - Document the new method on the class and in the cleanup docs.
   
   ### Result
   
   Callers can release the actor when they are done cleaning up, and a 
`Cleanup` used only for snapshot or event deletes never starts one at all. 
`close()` is idempotent.
   
   ### Tests
   
   - `sbt "core/Test/testOnly 
org.apache.pekko.persistence.cassandra.cleanup.CleanupCloseSpec"` — passed. New 
spec, asserts that no reconciliation actor is started when only snapshot/event 
operations are used, and that the one started by a tagged event operation 
terminates on `close()`. Needs no Cassandra.
   - `sbt "core/mimaReportBinaryIssues"` — passed.
   - `scalafmt --mode diff-ref=upstream/main --list` — no changes needed.
   - `git diff --check` — clean.
   - Cassandra integration tests not run — no local Cassandra (docker not 
running).
   
   ### References
   
   Refs #492 - resource leak found while auditing actor and session lifecycles.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to