Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[server] Retain deleted tokens for 13 months

Neeraj Gupta4d0bb0a951bb
diff --git a/server/cmd/museum/main.go b/server/cmd/museum/main.go
index 7d8efb523f..dca8b252ed 100644
--- a/server/cmd/museum/main.go
+++ b/server/cmd/museum/main.go
@@ -1068,6 +1068,8 @@ func setupAndStartCrons(userAuthRepo *repo.UserAuthRepository, collectionLinkRep
embeddingCtrl *embeddingCtrl.Controller,
healthCheckHandler *api.HealthCheckHandler,
castDb castRepo.Repository) {
+ const deletedTokenRetentionDays = 390 // 13 months using a fixed-day approximation
+
shouldSkipCron := viper.GetBool("jobs.cron.skip")
if shouldSkipCron {
log.Info("Skipping cron jobs")
@@ -1080,7 +1082,7 @@ func setupAndStartCrons(userAuthRepo *repo.UserAuthRepository, collectionLinkRep
})
schedule(c, "@every 24h", func() {
- _ = userAuthRepo.RemoveDeletedTokens(timeUtil.MicrosecondsBeforeDays(30))
+ _ = userAuthRepo.RemoveDeletedTokens(timeUtil.MicrosecondsBeforeDays(deletedTokenRetentionDays))
_ = castDb.DeleteOldSessions(context.Background(), timeUtil.MicrosecondsBeforeDays(7))
_ = collectionLinkRepo.CleanupAccessHistory(context.Background())
_ = fileLinkRepo.CleanupAccessHistory(context.Background())