inline _activityTimerExists() into stopActivityTimer()

This commit is contained in:
Piper Pentagram 2024-11-14 10:58:15 -08:00
parent 9b00241d2b
commit fe860726b3

View file

@ -120,20 +120,6 @@ func startActivityTimer(uid string) {
go activityTimers[uid].Start(context.Background()) go activityTimers[uid].Start(context.Background())
} }
/*
_activityTimerExists() returns true if there is already an activity timer for
the specified uid
WARNING: does not lock. do not call without locking.
*/
func _activityTimerExists(uid string) bool {
if _, ok := activityTimers[uid]; !ok {
return false
}
return true
}
/* /*
stopActivityTimer() cancels any running timer for the given uid stopActivityTimer() cancels any running timer for the given uid
and removes it from the activityTimers map. and removes it from the activityTimers map.
@ -142,7 +128,7 @@ func stopActivityTimer(uid string) {
timerMutex.Lock() timerMutex.Lock()
defer timerMutex.Unlock() defer timerMutex.Unlock()
if _activityTimerExists(uid) { if _, ok := activityTimers[uid]; !ok {
activityTimers[uid].Cancel() activityTimers[uid].Cancel()
delete(activityTimers, uid) delete(activityTimers, uid)
} }