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

Function shouldCancelChatFromControlNotification

coderd/x/chatd/chatd.go:5779–5800  ·  view source on GitHub ↗
(
	notify coderdpubsub.ChatStreamNotifyMessage,
	workerID uuid.UUID,
)

Source from the content-addressed store, hash-verified

5777}
5778
5779func shouldCancelChatFromControlNotification(
5780 notify coderdpubsub.ChatStreamNotifyMessage,
5781 workerID uuid.UUID,
5782) bool {
5783 status := database.ChatStatus(strings.TrimSpace(notify.Status))
5784 switch status {
5785 case database.ChatStatusWaiting, database.ChatStatusPending, database.ChatStatusError:
5786 return true
5787 case database.ChatStatusRunning:
5788 worker := strings.TrimSpace(notify.WorkerID)
5789 if worker == "" {
5790 return false
5791 }
5792 notifyWorkerID, err := uuid.Parse(worker)
5793 if err != nil {
5794 return false
5795 }
5796 return notifyWorkerID != workerID
5797 default:
5798 return false
5799 }
5800}
5801
5802func (p *Server) subscribeChatControl(
5803 ctx context.Context,

Callers 1

subscribeChatControlMethod · 0.85

Calls 2

ChatStatusTypeAlias · 0.92
ParseMethod · 0.65

Tested by

no test coverage detected