feat(logger): per-project background retention cleanup - #26
Merged
Conversation
…eanup Introduces a background goroutine in the logger service that periodically deletes expired LogEntry documents per-project, using each project's retention_days setting (default 90 days, 0 = infinite). Adds SIGTERM graceful shutdown wired through the same context. Adds GetAllProjects and DeleteExpiredLogs to the toolbox data layer. Adds integration test covering expired-log deletion, fresh-log preservation, and infinite-retention skip. Closes #9 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Silent fallback made misconfiguration invisible at runtime. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without a timeout, a slow or hung MongoDB would block the goroutine indefinitely on the signal context, which only cancels on SIGTERM. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fixed sleep is fragile under load; polling with a deadline matches the pattern used elsewhere in the integration suite (waitForLog). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
CLEANUP_INTERVALenv var (default1h) to configure the cleanup frequencyretention_days = 0are skipped (infinite retention)GetAllProjectsandDeleteExpiredLogsto the toolboxdatapackageTestRetentionCleanup) covering: expired log deletion, fresh log preservation, and infinite-retention skipCloses #9
Test plan
cd logwolf-server/toolbox && go build ./...passescd logwolf-server/logger && go build ./...passescd logwolf-server/integration && go test -tags integration -run TestRetentionCleanup -v -timeout 5mpassescd logwolf-server/integration && go test -tags integration ./... -v -timeout 5mpasses🤖 Generated with Claude Code