forked from mtusi2026/mtusi2026lab5
feat: clean up staging objects after processing and during reconciliation
This commit is contained in:
+10
-5
@@ -59,12 +59,13 @@ func run() error {
|
||||
return err
|
||||
}
|
||||
|
||||
reconciler := reconcile.New(s3Client, db.New(pool), log)
|
||||
reconciler := reconcile.New(pool, s3Client, db.New(pool), log)
|
||||
|
||||
report, err := reconciler.Run(ctx, reconcile.Options{
|
||||
DryRun: *dryRun,
|
||||
Grace: *grace,
|
||||
MaxDeletes: *maxDeletes,
|
||||
DryRun: *dryRun,
|
||||
Grace: *grace,
|
||||
MaxDeletes: *maxDeletes,
|
||||
StagingRetention: cfg.S3.StagingRetention,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -96,7 +97,8 @@ func printReport(report reconcile.Report) {
|
||||
report.ListPages,
|
||||
)
|
||||
fmt.Printf(
|
||||
"found orphan_objects=%d missing_attachments=%d corrupt_objects=%d\n",
|
||||
"found staging_objects=%d orphan_objects=%d missing_attachments=%d corrupt_objects=%d\n",
|
||||
len(report.StagingObjects),
|
||||
len(report.OrphanObjects),
|
||||
len(report.MissingAttachments),
|
||||
len(report.CorruptObjects),
|
||||
@@ -112,6 +114,9 @@ func printReport(report reconcile.Report) {
|
||||
report.MarkedFailed,
|
||||
)
|
||||
|
||||
for _, key := range report.StagingObjects {
|
||||
fmt.Printf("staging_object %s\n", key)
|
||||
}
|
||||
for _, key := range report.OrphanObjects {
|
||||
fmt.Printf("orphan_object %s\n", key)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user