@@ -48,10 +48,10 @@ const (
4848 defaultKeyFile = ""
4949 defaultCertDomain = ""
5050 defaultCleanupFrequency = 24 * time .Hour
51- defaultCleanupArchiveReadDays = 60
52- defaultCleanupArchiveUnreadDays = 180
51+ defaultCleanupArchiveReadInterval = 60 * 24 * time . Hour
52+ defaultCleanupArchiveUnreadInterval = 180 * 24 * time . Hour
5353 defaultCleanupArchiveBatchSize = 10000
54- defaultCleanupRemoveSessionsDays = 30
54+ defaultCleanupRemoveSessionsInterval = 30 * 24 * time . Hour
5555 defaultMediaProxyHTTPClientTimeout = 120 * time .Second
5656 defaultMediaProxyMode = "http-only"
5757 defaultMediaResourceTypes = "image"
@@ -126,10 +126,10 @@ type options struct {
126126 certDomain string
127127 certKeyFile string
128128 cleanupFrequencyInterval time.Duration
129- cleanupArchiveReadDays int
130- cleanupArchiveUnreadDays int
129+ cleanupArchiveReadInterval time. Duration
130+ cleanupArchiveUnreadInterval time. Duration
131131 cleanupArchiveBatchSize int
132- cleanupRemoveSessionsDays int
132+ cleanupRemoveSessionsInterval time. Duration
133133 forceRefreshInterval time.Duration
134134 batchSize int
135135 schedulerEntryFrequencyMinInterval time.Duration
@@ -210,10 +210,10 @@ func NewOptions() *options {
210210 certDomain : defaultCertDomain ,
211211 certKeyFile : defaultKeyFile ,
212212 cleanupFrequencyInterval : defaultCleanupFrequency ,
213- cleanupArchiveReadDays : defaultCleanupArchiveReadDays ,
214- cleanupArchiveUnreadDays : defaultCleanupArchiveUnreadDays ,
213+ cleanupArchiveReadInterval : defaultCleanupArchiveReadInterval ,
214+ cleanupArchiveUnreadInterval : defaultCleanupArchiveUnreadInterval ,
215215 cleanupArchiveBatchSize : defaultCleanupArchiveBatchSize ,
216- cleanupRemoveSessionsDays : defaultCleanupRemoveSessionsDays ,
216+ cleanupRemoveSessionsInterval : defaultCleanupRemoveSessionsInterval ,
217217 pollingFrequency : defaultPollingFrequency ,
218218 forceRefreshInterval : defaultForceRefreshInterval ,
219219 batchSize : defaultBatchSize ,
@@ -366,24 +366,24 @@ func (o *options) CleanupFrequency() time.Duration {
366366 return o .cleanupFrequencyInterval
367367}
368368
369- // CleanupArchiveReadDays returns the number of days after which marking read items as removed.
370- func (o * options ) CleanupArchiveReadDays () int {
371- return o .cleanupArchiveReadDays
369+ // CleanupArchiveReadDays returns the interval after which marking read items as removed.
370+ func (o * options ) CleanupArchiveReadInterval () time. Duration {
371+ return o .cleanupArchiveReadInterval
372372}
373373
374- // CleanupArchiveUnreadDays returns the number of days after which marking unread items as removed.
375- func (o * options ) CleanupArchiveUnreadDays () int {
376- return o .cleanupArchiveUnreadDays
374+ // CleanupArchiveUnreadDays returns the interval after which marking unread items as removed.
375+ func (o * options ) CleanupArchiveUnreadInterval () time. Duration {
376+ return o .cleanupArchiveUnreadInterval
377377}
378378
379379// CleanupArchiveBatchSize returns the number of entries to archive for each interval.
380380func (o * options ) CleanupArchiveBatchSize () int {
381381 return o .cleanupArchiveBatchSize
382382}
383383
384- // CleanupRemoveSessionsDays returns the number of days after which to remove sessions.
385- func (o * options ) CleanupRemoveSessionsDays () int {
386- return o .cleanupRemoveSessionsDays
384+ // CleanupRemoveSessionsDays returns the interval after which to remove sessions.
385+ func (o * options ) CleanupRemoveSessionsInterval () time. Duration {
386+ return o .cleanupRemoveSessionsInterval
387387}
388388
389389// WorkerPoolSize returns the number of background worker.
@@ -723,9 +723,9 @@ func (o *options) SortedOptions(redactSecret bool) []*option {
723723 "CERT_FILE" : o .certFile ,
724724 "CLEANUP_FREQUENCY_HOURS" : int (o .cleanupFrequencyInterval .Hours ()),
725725 "CLEANUP_ARCHIVE_BATCH_SIZE" : o .cleanupArchiveBatchSize ,
726- "CLEANUP_ARCHIVE_READ_DAYS" : o . cleanupArchiveReadDays ,
727- "CLEANUP_ARCHIVE_UNREAD_DAYS" : o . cleanupArchiveUnreadDays ,
728- "CLEANUP_REMOVE_SESSIONS_DAYS" : o . cleanupRemoveSessionsDays ,
726+ "CLEANUP_ARCHIVE_READ_DAYS" : int ( o . cleanupArchiveReadInterval . Hours () / 24 ) ,
727+ "CLEANUP_ARCHIVE_UNREAD_DAYS" : int ( o . cleanupArchiveUnreadInterval . Hours () / 24 ) ,
728+ "CLEANUP_REMOVE_SESSIONS_DAYS" : int ( o . cleanupRemoveSessionsInterval . Hours () / 24 ) ,
729729 "CREATE_ADMIN" : o .createAdmin ,
730730 "DATABASE_CONNECTION_LIFETIME" : o .databaseConnectionLifetime ,
731731 "DATABASE_MAX_CONNS" : o .databaseMaxConns ,
0 commit comments