inline _activityTimerExists() into stopActivityTimer()
This commit is contained in:
parent
9b00241d2b
commit
fe860726b3
1 changed files with 1 additions and 15 deletions
|
|
@ -120,20 +120,6 @@ func startActivityTimer(uid string) {
|
|||
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
|
||||
and removes it from the activityTimers map.
|
||||
|
|
@ -142,7 +128,7 @@ func stopActivityTimer(uid string) {
|
|||
timerMutex.Lock()
|
||||
defer timerMutex.Unlock()
|
||||
|
||||
if _activityTimerExists(uid) {
|
||||
if _, ok := activityTimers[uid]; !ok {
|
||||
activityTimers[uid].Cancel()
|
||||
delete(activityTimers, uid)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue