| 5470 | } |
| 5471 | |
| 5472 | func (p *Server) publishStatus(chatID uuid.UUID, status database.ChatStatus, workerID uuid.NullUUID) { |
| 5473 | p.publishEvent(chatID, codersdk.ChatStreamEvent{ |
| 5474 | Type: codersdk.ChatStreamEventTypeStatus, |
| 5475 | Status: &codersdk.ChatStreamStatus{Status: codersdk.ChatStatus(status)}, |
| 5476 | }) |
| 5477 | notify := coderdpubsub.ChatStreamNotifyMessage{ |
| 5478 | Status: string(status), |
| 5479 | } |
| 5480 | if workerID.Valid { |
| 5481 | notify.WorkerID = workerID.UUID.String() |
| 5482 | } |
| 5483 | p.publishChatStreamNotify(chatID, notify) |
| 5484 | } |
| 5485 | |
| 5486 | // publishChatStreamNotify broadcasts a per-chat stream notification via |
| 5487 | // PostgreSQL pubsub so that all replicas can merge durable database updates |