MCPcopy Create free account
hub / github.com/PasarGuard/node / runStatsUpdateLoop

Method runStatsUpdateLoop

backend/wireguard/jobs.go:25–36  ·  view source on GitHub ↗

runStatsUpdateLoop runs the stats update loop

(ctx context.Context)

Source from the content-addressed store, hash-verified

23
24// runStatsUpdateLoop runs the stats update loop
25func (wg *WireGuard) runStatsUpdateLoop(ctx context.Context) {
26 for {
27 select {
28 case <-ctx.Done():
29 return
30 case <-wg.updateTicker.C:
31 wg.updateConnectedPeers(ctx)
32 case <-wg.cleanupTicker.C:
33 wg.cleanupOfflineUsers(ctx)
34 }
35 }
36}
37
38// updateConnectedPeers updates stats for connected users only
39func (wg *WireGuard) updateConnectedPeers(ctx context.Context) {

Callers 1

initStatsTickersMethod · 0.95

Calls 2

updateConnectedPeersMethod · 0.95
cleanupOfflineUsersMethod · 0.95

Tested by

no test coverage detected