diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 6a01e74..a51e4f2 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,10 +4,9 @@
-
+
-
-
+
@@ -124,7 +123,8 @@
-
+
+
true
diff --git a/pkg/internal/services/recycler.go b/pkg/internal/services/recycler.go
index 683a66b..d6f08fe 100644
--- a/pkg/internal/services/recycler.go
+++ b/pkg/internal/services/recycler.go
@@ -51,7 +51,7 @@ func RunMarkDeletionTask() {
for _, pool := range pendingPools {
lifecycle := fmt.Sprintf("%d seconds", *pool.Config.Data().ExistLifecycle)
tx := database.C.
- Where("pool_id = ? AND created_at < NOW() - INTERVAL ?", pool.ID, lifecycle).
+ Where("pool_id = ? AND AND created_at < NOW() - INTERVAL ?", pool.ID, lifecycle).
Updates(&models.Attachment{CleanedAt: lo.ToPtr(time.Now())})
log.Info().
Str("pool", pool.Alias).
@@ -68,6 +68,9 @@ func RunScheduleDeletionTask() {
}
for idx, attachment := range attachments {
+ if attachment.RefID != nil {
+ continue
+ }
if err := DeleteFile(attachment); err != nil {
log.Error().
Uint("id", attachment.ID).