MCPcopy Create free account
hub / github.com/PostHog/duckgres / waitForConnectionWaiters

Function waitForConnectionWaiters

controlplane/session_mgr_test.go:549–565  ·  view source on GitHub ↗
(t *testing.T, sm *SessionManager, want int)

Source from the content-addressed store, hash-verified

547}
548
549func waitForConnectionWaiters(t *testing.T, sm *SessionManager, want int) {
550 t.Helper()
551 deadline := time.Now().Add(time.Second)
552 for time.Now().Before(deadline) {
553 sm.mu.RLock()
554 got := len(sm.waiters)
555 sm.mu.RUnlock()
556 if got == want {
557 return
558 }
559 time.Sleep(time.Millisecond)
560 }
561 sm.mu.RLock()
562 got := len(sm.waiters)
563 sm.mu.RUnlock()
564 t.Fatalf("timed out waiting for %d connection waiters, got %d", want, got)
565}
566
567func TestSessionManager_ConnectionLimits_FIFO(t *testing.T) {
568 ctx := context.Background()

Calls 2

AddMethod · 0.80
NowMethod · 0.80

Tested by

no test coverage detected