Add _prune_expired() helper that removes entries older than the
cooldown threshold. Called from _record_review() and _record_triage()
before adding new entries, so the dicts never grow beyond the number
of unique PRs/issues active within the cooldown window.
Previously, entries accumulated indefinitely with no cleanup.
Each entry is small (~120 bytes) and growth is slow (~1,560/year),
but a long-running service should not have unbounded memory growth.
Also adds cooldown parameter to _record_review() so pruning uses
the actual configured value rather than a hardcoded constant.
Fixes #156
Summary
Add lazy pruning to the PR review and issue triage cooldown dicts so they don't grow without bound over the lifetime of the service.
The problem
_review_cooldownsand_triage_cooldownsaccumulate one entry per unique(repo, number)key. Entries are added by_record_review()and_record_triage()but never removed. Each entry is small (~120 bytes) and growth is slow, but a long-running service should not have unbounded memory growth.The fix
_prune_expired()removes entries older than the cooldown threshold. Called from both_record_*functions before adding a new entry, so the dicts never grow beyond the number of unique PRs/issues active within the cooldown window.Changes
_prune_expired()helper_record_review()signaturecooldownparameter so pruning uses the actual configured value_record_review()body_prune_expiredbefore adding_record_triage()body_prune_expiredwith_TRIAGE_COOLDOWN_SECONDSbefore addingcooldownto_record_review()Test plan
test_removes_old_entries- entries older than max_age are prunedtest_retains_recent_entries- entries within max_age survivetest_empty_dict_is_noop- pruning an empty dict does nothingtest_record_review_prunes_before_adding- old entries removed before new one addedtest_record_triage_prunes_before_adding- same for triagecooldownparametermake checkcleanFixes #156