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

Method PublishDiffStatusChange

coderd/x/chatd/chatd.go:5600–5618  ·  view source on GitHub ↗

PublishDiffStatusChange broadcasts a diff_status_change event for the given chat so that watching clients know to re-fetch the diff status. This is called from the HTTP layer after the diff status is updated in the database.

(ctx context.Context, chatID uuid.UUID)

Source from the content-addressed store, hash-verified

5598// status. This is called from the HTTP layer after the diff status
5599// is updated in the database.
5600func (p *Server) PublishDiffStatusChange(ctx context.Context, chatID uuid.UUID) error {
5601 if p.pubsub == nil {
5602 return nil
5603 }
5604
5605 chat, err := p.db.GetChatByID(ctx, chatID)
5606 if err != nil {
5607 return xerrors.Errorf("get chat: %w", err)
5608 }
5609
5610 dbStatus, err := p.db.GetChatDiffStatusByChatID(ctx, chatID)
5611 if err != nil {
5612 return xerrors.Errorf("get chat diff status: %w", err)
5613 }
5614
5615 sdkStatus := db2sdk.ChatDiffStatus(chatID, &dbStatus)
5616 p.publishChatPubsubEvent(chat, codersdk.ChatWatchEventKindDiffStatusChange, &sdkStatus)
5617 return nil
5618}
5619
5620func (p *Server) publishRetry(chatID uuid.UUID, payload *codersdk.ChatStreamRetry) {
5621 if payload == nil {

Callers

nothing calls this directly

Calls 5

ChatDiffStatusFunction · 0.92
GetChatByIDMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected