summaryrefslogtreecommitdiff
path: root/internal/media/pruneremote.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/media/pruneremote.go')
-rw-r--r--internal/media/pruneremote.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/internal/media/pruneremote.go b/internal/media/pruneremote.go
index f7b77d32e..a01995740 100644
--- a/internal/media/pruneremote.go
+++ b/internal/media/pruneremote.go
@@ -21,7 +21,6 @@ package media
import (
"context"
"fmt"
- "time"
"codeberg.org/gruf/go-store/storage"
"github.com/sirupsen/logrus"
@@ -32,15 +31,10 @@ import (
func (m *manager) PruneAllRemote(ctx context.Context, olderThanDays int) (int, error) {
var totalPruned int
- // convert days into a duration string
- olderThanHoursString := fmt.Sprintf("%dh", olderThanDays*24)
- // parse the duration string into a duration
- olderThanHours, err := time.ParseDuration(olderThanHoursString)
+ olderThan, err := parseOlderThan(olderThanDays)
if err != nil {
- return totalPruned, fmt.Errorf("PruneAllRemote: %d", err)
+ return totalPruned, fmt.Errorf("PruneAllRemote: error parsing olderThanDays %d: %s", olderThanDays, err)
}
- // 'subtract' that from the time now to give our threshold
- olderThan := time.Now().Add(-olderThanHours)
logrus.Infof("PruneAllRemote: pruning media older than %s", olderThan)
// select 20 attachments at a time and prune them