Skip to content

Commit a3f8c15

Browse files
committed
!dropme: add debug log
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
1 parent 60d14e8 commit a3f8c15

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/talk/renderer/UserStatus/composables/useAppIdle.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { createSharedComposable, useEventListener } from '@vueuse/core'
7-
import { onBeforeUnmount, ref } from 'vue'
7+
import { onBeforeUnmount, ref, watchEffect } from 'vue'
88

99
const WINDOW_ACTIVE_EVENTS: (keyof WindowEventMap)[] = ['mousemove', 'mousedown', 'resize', 'keydown', 'touchstart', 'wheel']
1010

@@ -47,5 +47,9 @@ export const useAppIdle = createSharedComposable((threshold: number = 60_000) =>
4747
clearTimeout(activityTimeout)
4848
})
4949

50+
watchEffect(() => {
51+
console.debug(`[IDLE] AppIdle is changed: ${isIdle.value}`)
52+
})
53+
5054
return isIdle
5155
})

src/talk/renderer/UserStatus/composables/useIdleDetector.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const useIdleDetector = createSharedComposable((threshold: number = 60_00
3636
idleDetector.addEventListener('change', () => {
3737
userState.value = idleDetector.userState!
3838
screenState.value = idleDetector.screenState!
39+
console.debug(`[IDLE] IdleDetector state changed: userState = ${userState.value}, screenState = ${screenState.value}`)
3940
})
4041
await idleDetector.start({
4142
threshold,

src/talk/renderer/UserStatus/useHeartbeat.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export const useHeartbeat = createSharedComposable(() => {
3838
* Send a heartbeat
3939
*/
4040
async function heartbeat() {
41+
console.debug(`[IDLE] Sending heartbeat, isAway = ${isAway.value}`)
4142
try {
4243
await userStatusStore.updateUserStatusWithHeartbeat(isAway.value)
4344
} catch (error) {
@@ -59,6 +60,7 @@ export const useHeartbeat = createSharedComposable(() => {
5960

6061
// Restart heartbeat to immediately notify server on state change
6162
watch(isAway, () => {
63+
console.debug(`[IDLE] Restarting heartbeat, isAway = ${isAway.value}`)
6264
// Note: both app and system level activity state changes to inactive with a threshold.
6365
// Only lock/unlock state can be changed many times in a short period, but it is unlikely
6466
// Thus it unlikely overloads with heartbeat, no need to debounce

0 commit comments

Comments
 (0)