Implement test run retention cleanup - #223
Open
damilolaedwards wants to merge 1 commit into
Open
Conversation
cleanupTestHistory was a stub that never removed anything, so every finished test run stayed in the in-memory run map for the life of the process. On a coordinator that runs cron or startup-scheduled tests continuously, this pins an ever-growing set of schedulers, task states, and buffered loggers with no way to bound it, and makes the testRetentionTime setting a no-op. Prune runs whose status is terminal (success, failure, aborted, or skipped) once they are older than the configured retention window, leaving pending and running tests untouched. This only drops the in-memory reference; persisted results are unaffected and continue to be served from the database once a run is no longer in the map, the same fallback path the test history endpoint already relies on.
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.
Summary
cleanupTestHistory was a stub that never removed anything, so every finished test run stayed in the in-memory run map for the life of the coordinator process. On a deployment that runs cron or startup-scheduled tests continuously, this pins an ever-growing set of schedulers, task states, and buffered loggers with no bound, and makes the testRetentionTime setting a no-op regardless of what it's set to.
This change prunes runs whose status is terminal (success, failure, aborted, or skipped) once they are older than the configured retention window, leaving pending and running tests untouched. Evicting a run only drops the in-memory reference; persisted results are unaffected. Coordinator.GetTestByRunID already falls back to loading a run straight from the database when it is missing from the in-memory map, so a run's detail page and logs keep working the same way after eviction, just served from the database instead of memory.
Test plan