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

Method publishLoop

coderd/database/pubsub/watchdog.go:79–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77}
78
79func (w *Watchdog) publishLoop() {
80 defer w.wg.Done()
81 tkr := w.clock.TickerFunc(w.ctx, periodHeartbeat, func() error {
82 err := w.ps.Publish(EventPubsubWatchdog, []byte{})
83 if err != nil {
84 w.logger.Warn(w.ctx, "failed to publish heartbeat on pubsub watchdog", slog.Error(err))
85 } else {
86 w.logger.Debug(w.ctx, "published heartbeat on pubsub watchdog")
87 }
88 return err
89 }, "publish")
90 // ignore the error, since we log before returning the error
91 _ = tkr.Wait()
92}
93
94func (w *Watchdog) subscribeMonitor() {
95 defer w.wg.Done()

Callers 1

NewWatchdogWithClockFunction · 0.95

Calls 4

PublishMethod · 0.65
WaitMethod · 0.65
DoneMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected