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

Function New

coderd/database/pubsub/pubsub.go:685–693  ·  view source on GitHub ↗

New creates a new Pubsub implementation using a PostgreSQL connection.

(startCtx context.Context, logger slog.Logger, db *sql.DB, connectURL string)

Source from the content-addressed store, hash-verified

683
684// New creates a new Pubsub implementation using a PostgreSQL connection.
685func New(startCtx context.Context, logger slog.Logger, db *sql.DB, connectURL string) (*PGPubsub, error) {
686 p := newWithoutListener(logger, db)
687 if err := p.startListener(startCtx, connectURL); err != nil {
688 return nil, err
689 }
690 go p.listen()
691 logger.Debug(startCtx, "pubsub has started")
692 return p, nil
693}
694
695// newWithoutListener creates a new PGPubsub without creating the pqListener.
696func newWithoutListener(logger slog.Logger, db *sql.DB) *PGPubsub {

Callers 9

TestDriverFunction · 0.92
NewDBFunction · 0.92
TestPGPubsub_MetricsFunction · 0.92
TestPGPubsubDriverFunction · 0.92
TestPubsubFunction · 0.92
TestPubsub_orderingFunction · 0.92
TestPubsub_DisconnectFunction · 0.92
TestMeasureLatencyFunction · 0.92
ServerMethod · 0.92

Calls 3

newWithoutListenerFunction · 0.85
startListenerMethod · 0.80
listenMethod · 0.45

Tested by 7

TestDriverFunction · 0.74
TestPGPubsub_MetricsFunction · 0.74
TestPGPubsubDriverFunction · 0.74
TestPubsubFunction · 0.74
TestPubsub_orderingFunction · 0.74
TestPubsub_DisconnectFunction · 0.74
TestMeasureLatencyFunction · 0.74