MCPcopy Create free account
hub / github.com/MertJSX/folderhost / ScheduleDebouncedLog

Function ScheduleDebouncedLog

utils/ws_debounce_logging_system.go:18–44  ·  view source on GitHub ↗
(username, filePath string)

Source from the content-addressed store, hash-verified

16)
17
18func ScheduleDebouncedLog(username, filePath string) {
19 debounceMu.Lock()
20 defer debounceMu.Unlock()
21
22 if state, exists := debounceStates[username]; exists {
23 state.Mu.Lock()
24 if state.Timer != nil {
25 state.Timer.Stop()
26 }
27 state.Mu.Unlock()
28 }
29
30 state := &types.UserDebounceState{
31 FilePath: filePath,
32 Username: username,
33 }
34
35 state.Timer = time.AfterFunc(debounceDelay, func() {
36 createWriteFileLog(username, filePath)
37
38 debounceMu.Lock()
39 delete(debounceStates, username)
40 debounceMu.Unlock()
41 })
42
43 debounceStates[username] = state
44}
45
46func TriggerPendingLog(username, filePath string) {
47 debounceMu.Lock()

Callers 1

processWebSocketMessageFunction · 0.92

Calls 1

createWriteFileLogFunction · 0.85

Tested by

no test coverage detected