MCPcopy Create free account
hub / github.com/coder/coder / dial

Method dial

enterprise/coderd/x/chatd/chatd.go:101–131  ·  view source on GitHub ↗

dial returns the configured dialer, preferring DialerFn (tests) over the real dialRelay. Returns nil when relay is not configured.

()

Source from the content-addressed store, hash-verified

99// dial returns the configured dialer, preferring DialerFn (tests)
100// over the real dialRelay. Returns nil when relay is not configured.
101func (c MultiReplicaSubscribeConfig) dial() func(
102 ctx context.Context,
103 chatID uuid.UUID,
104 workerID uuid.UUID,
105 requestHeader http.Header,
106) (
107 []codersdk.ChatStreamEvent,
108 <-chan codersdk.ChatStreamEvent,
109 func(),
110 error,
111) {
112 if c.DialerFn != nil {
113 return c.DialerFn
114 }
115 if c.ResolveReplicaAddress == nil {
116 return nil
117 }
118 return func(
119 ctx context.Context,
120 chatID uuid.UUID,
121 workerID uuid.UUID,
122 requestHeader http.Header,
123 ) (
124 []codersdk.ChatStreamEvent,
125 <-chan codersdk.ChatStreamEvent,
126 func(),
127 error,
128 ) {
129 return dialRelay(ctx, chatID, workerID, requestHeader, c, c.clock())
130 }
131}
132
133// clock returns the quartz.Clock to use. Defaults to a real clock
134// when not set.

Callers 1

Calls 2

clockMethod · 0.95
dialRelayFunction · 0.85

Tested by

no test coverage detected