( notify coderdpubsub.ChatStreamNotifyMessage, workerID uuid.UUID, )
| 5777 | } |
| 5778 | |
| 5779 | func 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 | |
| 5802 | func (p *Server) subscribeChatControl( |
| 5803 | ctx context.Context, |
no test coverage detected