MCPcopy Create free account
hub / github.com/cortexproject/cortex / NewActiveUsersCleanupService

Function NewActiveUsersCleanupService

pkg/util/users/active_user.go:122–131  ·  view source on GitHub ↗
(cleanupInterval, inactiveTimeout time.Duration, cleanupFn func(string))

Source from the content-addressed store, hash-verified

120}
121
122func NewActiveUsersCleanupService(cleanupInterval, inactiveTimeout time.Duration, cleanupFn func(string)) *ActiveUsersCleanupService {
123 s := &ActiveUsersCleanupService{
124 activeUsers: NewActiveUsers(),
125 cleanupFunc: cleanupFn,
126 inactiveTimeout: inactiveTimeout,
127 }
128
129 s.Service = services.NewTimerService(cleanupInterval, nil, s.iteration, nil).WithName("active users cleanup")
130 return s
131}
132
133func (s *ActiveUsersCleanupService) UpdateUserTimestamp(user string, now time.Time) {
134 s.activeUsers.UpdateUserTimestamp(user, now.UnixNano())

Calls 3

NewTimerServiceFunction · 0.92
NewActiveUsersFunction · 0.85
WithNameMethod · 0.80

Tested by

no test coverage detected