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

Method publishWorkspaceUpdate

coderd/workspaces.go:3017–3036  ·  view source on GitHub ↗
(ctx context.Context, ownerID uuid.UUID, event wspubsub.WorkspaceEvent)

Source from the content-addressed store, hash-verified

3015}
3016
3017func (api *API) publishWorkspaceUpdate(ctx context.Context, ownerID uuid.UUID, event wspubsub.WorkspaceEvent) {
3018 err := event.Validate()
3019 if err != nil {
3020 api.Logger.Warn(ctx, "invalid workspace update event",
3021 slog.F("workspace_id", event.WorkspaceID),
3022 slog.F("event_kind", event.Kind), slog.Error(err))
3023 return
3024 }
3025 msg, err := json.Marshal(event)
3026 if err != nil {
3027 api.Logger.Warn(ctx, "failed to marshal workspace update",
3028 slog.F("workspace_id", event.WorkspaceID), slog.Error(err))
3029 return
3030 }
3031 err = api.Pubsub.Publish(wspubsub.WorkspaceEventChannel(ownerID), msg)
3032 if err != nil {
3033 api.Logger.Warn(ctx, "failed to publish workspace update",
3034 slog.F("workspace_id", event.WorkspaceID), slog.Error(err))
3035 }
3036}
3037
3038func (api *API) publishWorkspaceAgentLogsUpdate(ctx context.Context, workspaceAgentID uuid.UUID, m agentsdk.LogsNotifyMessage) {
3039 b, err := json.Marshal(m)

Callers 6

patchWorkspaceMethod · 0.95
putExtendWorkspaceMethod · 0.95

Calls 5

WorkspaceEventChannelFunction · 0.92
ValidateMethod · 0.65
PublishMethod · 0.65
ErrorMethod · 0.45
MarshalMethod · 0.45

Tested by

no test coverage detected