aboutsummaryrefslogtreecommitdiffhomepage
path: root/scheduler
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-05-19 16:40:24 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-05-19 16:45:27 -0700
commitf19ab21b7d7dcddb3de0536c272cb22d581eb8d7 (patch)
tree73eb4ad19fd69aee158be85be60ea6cd9f53135e /scheduler
parentff8e0c6b3dca3bf46b0abda284b486467a23dd07 (diff)
Archive read entries automatically after 60 days
Diffstat (limited to 'scheduler')
-rw-r--r--scheduler/scheduler.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/scheduler/scheduler.go b/scheduler/scheduler.go
index 5d6836e..e354c09 100644
--- a/scheduler/scheduler.go
+++ b/scheduler/scheduler.go
@@ -27,14 +27,18 @@ func NewFeedScheduler(store *storage.Storage, workerPool *WorkerPool, frequency,
}()
}
-// NewSessionScheduler starts a new scheduler that clean old sessions.
-func NewSessionScheduler(store *storage.Storage, frequency int) {
+// NewCleanupScheduler starts a new scheduler that clean old sessions and archive read items.
+func NewCleanupScheduler(store *storage.Storage, frequency int) {
go func() {
c := time.Tick(time.Duration(frequency) * time.Hour)
for range c {
nbSessions := store.CleanOldSessions()
nbUserSessions := store.CleanOldUserSessions()
- logger.Info("[SessionScheduler] cleaned %d sessions and %d user sessions", nbSessions, nbUserSessions)
+ logger.Info("[CleanupScheduler] Cleaned %d sessions and %d user sessions", nbSessions, nbUserSessions)
+
+ if err := store.ArchiveEntries(); err != nil {
+ logger.Error("[CleanupScheduler] %v", err)
+ }
}
}()
}