Skip to content

feat(logger): per-project background retention cleanup - #26

Merged
jpricardo merged 6 commits into
feat/multi-tenancyfrom
feat/retention-cleanup
Apr 19, 2026
Merged

feat(logger): per-project background retention cleanup#26
jpricardo merged 6 commits into
feat/multi-tenancyfrom
feat/retention-cleanup

Conversation

@jpricardo

Copy link
Copy Markdown
Owner

Summary

  • Replaces the global MongoDB TTL index strategy with a per-project background cleanup goroutine running in the logger service
  • Adds CLEANUP_INTERVAL env var (default 1h) to configure the cleanup frequency
  • Projects with retention_days = 0 are skipped (infinite retention)
  • Wires SIGTERM/SIGINT graceful shutdown through a shared context, cleanly terminating both the cleanup goroutine and the HTTP server
  • Adds GetAllProjects and DeleteExpiredLogs to the toolbox data package
  • Adds integration test (TestRetentionCleanup) covering: expired log deletion, fresh log preservation, and infinite-retention skip

Closes #9

Test plan

  • cd logwolf-server/toolbox && go build ./... passes
  • cd logwolf-server/logger && go build ./... passes
  • cd logwolf-server/integration && go test -tags integration -run TestRetentionCleanup -v -timeout 5m passes
  • Full integration suite: cd logwolf-server/integration && go test -tags integration ./... -v -timeout 5m passes

🤖 Generated with Claude Code

…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>
@vercel

vercel Bot commented Apr 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
logwolf-docs Ready Ready Preview, Comment Apr 19, 2026 5:22pm

jpricardo and others added 5 commits April 19, 2026 14:19
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>
@jpricardo
jpricardo merged commit bb59433 into feat/multi-tenancy Apr 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant