Add per-webhook event retention reaper (closes #63)
All checks were successful
check / check (push) Successful in 5s
All checks were successful
check / check (push) Successful in 5s
This commit is contained in:
31
internal/database/export_test.go
Normal file
31
internal/database/export_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
// NewTestRetentionReaper builds a RetentionReaper backed by the given
|
||||
// main database and per-webhook database manager, without the fx
|
||||
// lifecycle. Intended for tests.
|
||||
func NewTestRetentionReaper(
|
||||
db *Database,
|
||||
mgr *WebhookDBManager,
|
||||
) *RetentionReaper {
|
||||
return &RetentionReaper{
|
||||
db: db,
|
||||
dbManager: mgr,
|
||||
log: slog.New(slog.NewTextHandler(
|
||||
os.Stderr,
|
||||
&slog.HandlerOptions{Level: slog.LevelDebug},
|
||||
)),
|
||||
interval: time.Hour,
|
||||
}
|
||||
}
|
||||
|
||||
// ExportSweep runs a single retention sweep synchronously for tests.
|
||||
func (r *RetentionReaper) ExportSweep(ctx context.Context) {
|
||||
r.sweep(ctx)
|
||||
}
|
||||
Reference in New Issue
Block a user