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

Method DialContext

coderd/database/pubsub/pubsub.go:477–496  ·  view source on GitHub ↗
(ctx context.Context, network, address string)

Source from the content-addressed store, hash-verified

475}
476
477func (d logDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
478 deadline, hasDeadline := ctx.Deadline()
479 timeoutMS := 0
480 if hasDeadline {
481 timeoutMS = int(time.Until(deadline) / time.Millisecond)
482 }
483
484 logger := d.logger.With(slog.F("network", network), slog.F("address", address), slog.F("timeout_ms", timeoutMS))
485
486 logger.Debug(ctx, "pubsub dialing postgres")
487 start := time.Now()
488 conn, err := d.d.DialContext(ctx, network, address)
489 if err != nil {
490 logger.Error(ctx, "pubsub failed to dial postgres")
491 return nil, err
492 }
493 elapsed := time.Since(start)
494 logger.Debug(ctx, "pubsub postgres TCP connection established", slog.F("elapsed_ms", elapsed.Milliseconds()))
495 return conn, nil
496}
497
498func (p *PGPubsub) startListener(ctx context.Context, connectURL string) error {
499 p.connected.Set(0)

Callers 2

DialMethod · 0.95
DialTimeoutMethod · 0.95

Calls 2

DialContextMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected