0.1.52 Gateway
This commit is contained in:
@@ -51,6 +51,20 @@ func (s *Server) RegisterHousekeeping(sched *scheduler.Scheduler) {
|
||||
},
|
||||
})
|
||||
|
||||
sched.Register(scheduler.Task{
|
||||
ID: "device-activity-cleanup",
|
||||
Name: "Device activity cleanup",
|
||||
Group: "Housekeeping",
|
||||
Description: fmt.Sprintf(
|
||||
"Removes the daily first-use marks that are older than %d days.",
|
||||
int(store.DeviceActivityRetention/(24*time.Hour))),
|
||||
Interval: 24 * time.Hour,
|
||||
Run: func(ctx context.Context) (string, error) {
|
||||
removed, err := s.store.PruneDeviceActivityDays(ctx, store.DeviceActivityRetention)
|
||||
return countDetail(removed, "activity mark"), err
|
||||
},
|
||||
})
|
||||
|
||||
sched.Register(scheduler.Task{
|
||||
ID: "integration-cleanup",
|
||||
Name: "Integration delivery cleanup",
|
||||
@@ -103,10 +117,13 @@ func (s *Server) RegisterHousekeeping(sched *scheduler.Scheduler) {
|
||||
Group: "Housekeeping",
|
||||
Description: fmt.Sprintf(
|
||||
"Retires gateway tokens unused for %d days, along with the Emby token each one holds.",
|
||||
int(s.cfg.SessionIdleExpiry/(24*time.Hour))),
|
||||
int(s.sessionIdleExpiry()/(24*time.Hour))),
|
||||
Interval: 6 * time.Hour,
|
||||
Run: func(ctx context.Context) (string, error) {
|
||||
removed, err := s.store.DeleteIdleSessions(ctx, s.cfg.SessionIdleExpiry)
|
||||
// Read at run time rather than closed over: the description above is written
|
||||
// once when the task is registered, but the sweep itself must follow the
|
||||
// operator's setting without a restart.
|
||||
removed, err := s.store.DeleteIdleSessions(ctx, s.sessionIdleExpiry())
|
||||
return countDetail(removed, "idle session"), err
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user