From fe860726b3dca7210615a8bd1a73cad9aa4668a3 Mon Sep 17 00:00:00 2001 From: Piper Pentagram Date: Thu, 14 Nov 2024 10:58:15 -0800 Subject: [PATCH] inline _activityTimerExists() into stopActivityTimer() --- internal/discord/activity.go | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/internal/discord/activity.go b/internal/discord/activity.go index a9fab33..afa6c8d 100644 --- a/internal/discord/activity.go +++ b/internal/discord/activity.go @@ -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) }