MCPcopy
hub / github.com/jackc/pgx / BenchmarkContextWatcherCancelled

Function BenchmarkContextWatcherCancelled

pgconn/ctxwatch/context_watcher_test.go:164–173  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

162}
163
164func BenchmarkContextWatcherCancelled(b *testing.B) {
165 cw := ctxwatch.NewContextWatcher(&testHandler{handleCancel: func(context.Context) {}, handleUnwatchAfterCancel: func() {}})
166
167 for b.Loop() {
168 ctx, cancel := context.WithCancel(context.Background())
169 cw.Watch(ctx)
170 cancel()
171 cw.Unwatch()
172 }
173}
174
175func BenchmarkContextWatcherCancellable(b *testing.B) {
176 cw := ctxwatch.NewContextWatcher(&testHandler{handleCancel: func(context.Context) {}, handleUnwatchAfterCancel: func() {}})

Callers

nothing calls this directly

Calls 3

WatchMethod · 0.95
UnwatchMethod · 0.95
NewContextWatcherFunction · 0.92

Tested by

no test coverage detected