MCPcopy Index your code
hub / github.com/coder/coder / rateLimitedScan

Method rateLimitedScan

agent/agentgit/agentgit.go:272–293  ·  view source on GitHub ↗
(ctx context.Context, scanFn func())

Source from the content-addressed store, hash-verified

270}
271
272func (h *Handler) rateLimitedScan(ctx context.Context, scanFn func()) {
273 h.mu.Lock()
274 elapsed := h.clock.Since(h.lastScanAt)
275 if elapsed < scanCooldown {
276 h.mu.Unlock()
277
278 // Wait for cooldown then scan.
279 remaining := scanCooldown - elapsed
280 timer := h.clock.NewTimer(remaining)
281 defer timer.Stop()
282 select {
283 case <-ctx.Done():
284 return
285 case <-timer.C:
286 }
287
288 scanFn()
289 return
290 }
291 h.mu.Unlock()
292 scanFn()
293}
294
295// isRepoDeleted returns true when the repo root directory or its .git
296// entry no longer represents a valid git repository. This

Callers 1

RunLoopMethod · 0.95

Implementers 8

dispatchInterceptorcoderd/notifications/utils_test.go
chanHandlercoderd/notifications/utils_test.go
barrierHandlercoderd/notifications/metrics_test.go
fakeHandlercoderd/notifications/notifications_tes
santaHandlercoderd/notifications/manager_test.go
InboxHandlercoderd/notifications/dispatch/inbox.go
SMTPHandlercoderd/notifications/dispatch/smtp.go
WebhookHandlercoderd/notifications/dispatch/webhook.

Calls 4

StopMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45
DoneMethod · 0.45

Tested by

no test coverage detected