MCPcopy Create free account
hub / github.com/Hidden-Node/GooseRelayVPN-AndroidClient / touchDailyWindow

Method touchDailyWindow

internal/carrier/quota.go:41–52  ·  view source on GitHub ↗

touchDailyWindow rolls over the daily counter when the previous window has elapsed. Returns whether a rollover occurred so the caller can log it outside the endpointMu critical section. Caller must hold c.endpointMu.

(ep *relayEndpoint, now time.Time)

Source from the content-addressed store, hash-verified

39//
40// Caller must hold c.endpointMu.
41func (c *Client) touchDailyWindow(ep *relayEndpoint, now time.Time) (rolledOver bool) {
42 if ep.dailyResetAt.IsZero() {
43 ep.dailyResetAt = nextQuotaReset(now)
44 return false
45 }
46 if now.Before(ep.dailyResetAt) {
47 return false
48 }
49 ep.dailyCount = 0
50 ep.dailyResetAt = nextQuotaReset(now)
51 return true
52}
53
54// bumpDailyCount records one Apps Script invocation for an endpoint.
55//

Callers 3

bumpDailyCountMethod · 0.95
endpointStatsLineMethod · 0.95
accountStatsLineMethod · 0.95

Calls 1

nextQuotaResetFunction · 0.85

Tested by

no test coverage detected