Add an auto-cleanup worker
This commit is contained in:
parent
6565c6fda4
commit
4304784796
5 changed files with 136 additions and 7 deletions
|
|
@ -22,6 +22,7 @@
|
|||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
|
|
@ -49,6 +50,12 @@ func RunServer(cfg *config.Config) error {
|
|||
|
||||
log.Printf("Connected to %s database", cfg.Database.Type)
|
||||
|
||||
// Start cleanup service for old reports
|
||||
ctx := context.Background()
|
||||
cleanupSvc := NewCleanupService(store, cfg.ReportRetention)
|
||||
cleanupSvc.Start(ctx)
|
||||
defer cleanupSvc.Stop()
|
||||
|
||||
// Start LMTP server in background
|
||||
go func() {
|
||||
if err := lmtp.StartServer(cfg.Email.LMTPAddr, store, cfg); err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue