0.1.52 Gateway

This commit is contained in:
ponzischeme89
2026-08-17 19:09:17 +12:00
parent d5a8d3ad88
commit 1da91e40a1
46 changed files with 1626 additions and 106 deletions
+19 -2
View File
@@ -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
},
})