MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / valid

Method valid

pkg/auth/rights/cache.go:58–72  ·  view source on GitHub ↗
(successTTL, errorTTL time.Duration)

Source from the content-addressed store, hash-verified

56}
57
58func (c *cachedRes) valid(successTTL, errorTTL time.Duration) bool {
59 if c == nil {
60 return false
61 }
62 select {
63 case <-c.waitChan:
64 default:
65 return true // still fetching...
66 }
67 now := now()
68 if c.err != nil {
69 return now.Sub(c.time) <= errorTTL
70 }
71 return now.Sub(c.time) <= successTTL
72}
73
74func (c *cachedRes) set(rights *ttnpb.Rights, err error) {
75 c.rights, c.err = rights, err

Callers 8

validMethod · 0.45
maybeCleanupMethod · 0.45
AuthInfoMethod · 0.45
ApplicationRightsMethod · 0.45
ClientRightsMethod · 0.45
GatewayRightsMethod · 0.45
OrganizationRightsMethod · 0.45
UserRightsMethod · 0.45

Calls 2

nowFunction · 0.85
SubMethod · 0.80

Tested by

no test coverage detected