runStatsUpdateLoop runs the stats update loop
(ctx context.Context)
| 23 | |
| 24 | // runStatsUpdateLoop runs the stats update loop |
| 25 | func (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 |
| 39 | func (wg *WireGuard) updateConnectedPeers(ctx context.Context) { |
no test coverage detected