MCPcopy Index your code
hub / github.com/coder/code-server / canTry

Method canTry

src/node/routes/login.ts:16–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14 private readonly hourLimiter = new Limiter({ tokensPerInterval: 12, interval: "hour" })
15
16 public canTry(): boolean {
17 // Note: we must check using >= 1 because technically when there are no tokens left
18 // you get back a number like 0.00013333333333333334
19 // which would cause fail if the logic were > 0
20 return this.minuteLimiter.getTokensRemaining() >= 1 || this.hourLimiter.getTokensRemaining() >= 1
21 }
22
23 public removeToken(): boolean {
24 return this.minuteLimiter.tryRemoveTokens(1) || this.hourLimiter.tryRemoveTokens(1)

Callers 2

login.test.tsFile · 0.80
login.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected