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

Struct PGPubsub

coderd/database/pubsub/pubsub.go:211–238  ·  view source on GitHub ↗

PGPubsub is a pubsub implementation using PostgreSQL.

Source from the content-addressed store, hash-verified

209
210// PGPubsub is a pubsub implementation using PostgreSQL.
211type PGPubsub struct {
212 logger slog.Logger
213 listenDone chan struct{}
214 pgListener pqListener
215 db *sql.DB
216
217 qMu sync.Mutex
218 queues map[string]*queueSet
219
220 // making the close state its own mutex domain simplifies closing logic so
221 // that we don't have to hold the qMu --- which could block processing
222 // notifications while the pqListener is closing.
223 closeMu sync.Mutex
224 closedListener bool
225 closeListenerErr error
226
227 publishesTotal *prometheus.CounterVec
228 subscribesTotal *prometheus.CounterVec
229 messagesTotal *prometheus.CounterVec
230 publishedBytesTotal prometheus.Counter
231 receivedBytesTotal prometheus.Counter
232 disconnectionsTotal prometheus.Counter
233 connected prometheus.Gauge
234
235 latencyMeasurer *LatencyMeasurer
236 latencyMeasureCounter atomic.Int64
237 latencyErrCounter atomic.Int64
238}
239
240// BufferSize is the maximum number of unhandled messages we will buffer
241// for a subscriber before dropping messages.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected