feat(qa): add synthesis conversations with source retention (#52)

This commit is contained in:
2026-11-25 19:46:06 +01:00
parent 90dd2a65d2
commit 287811184f
49 changed files with 2636 additions and 47 deletions

View File

@ -0,0 +1,25 @@
package summaryqa
import (
"context"
"time"
)
// Cleanup is retryable and deletes only expired temporary source rows. API reads
// also enforce expiration independently; a delayed worker never grants access.
func RunPurger(ctx context.Context, repo Repository, interval time.Duration, onFailure func()) {
ticker := time.NewTicker(interval)
defer ticker.Stop()
for {
attempt, cancel := context.WithTimeout(ctx, 10*time.Second)
if err := repo.PurgeExpiredQASources(attempt, time.Now()); err != nil && ctx.Err() == nil && onFailure != nil {
onFailure()
}
cancel()
select {
case <-ctx.Done():
return
case <-ticker.C:
}
}
}