(cleanupInterval, inactiveTimeout time.Duration, cleanupFn func(string))
| 107 | } |
| 108 | |
| 109 | func NewActiveUsersCleanupService(cleanupInterval, inactiveTimeout time.Duration, cleanupFn func(string)) *ActiveUsersCleanupService { |
| 110 | s := &ActiveUsersCleanupService{ |
| 111 | activeUsers: NewActiveUsers(), |
| 112 | cleanupFunc: cleanupFn, |
| 113 | inactiveTimeout: inactiveTimeout, |
| 114 | } |
| 115 | |
| 116 | s.Service = services.NewTimerService(cleanupInterval, nil, s.iteration, nil).WithName("active users cleanup") |
| 117 | return s |
| 118 | } |
| 119 | |
| 120 | func (s *ActiveUsersCleanupService) UpdateUserTimestamp(user string, now time.Time) { |
| 121 | s.activeUsers.UpdateUserTimestamp(user, now.UnixNano()) |
no test coverage detected