Skip to content

Commit 686a4aa

Browse files
committed
Standardize on workspace channel function
1 parent ba3e6ce commit 686a4aa

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

coderd/workspaces.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ func (api *API) watchWorkspace(rw http.ResponseWriter, r *http.Request) {
882882
})
883883
}
884884

885-
cancelWorkspaceSubscribe, err := api.Pubsub.Subscribe(watchWorkspaceChannel(workspace.ID), sendUpdate)
885+
cancelWorkspaceSubscribe, err := api.Pubsub.Subscribe(codersdk.WorkspaceNotifyChannel(workspace.ID), sendUpdate)
886886
if err != nil {
887887
_ = sendEvent(ctx, codersdk.ServerSentEvent{
888888
Type: codersdk.ServerSentEventTypeError,
@@ -1149,12 +1149,8 @@ func validWorkspaceSchedule(s *string) (sql.NullString, error) {
11491149
}, nil
11501150
}
11511151

1152-
func watchWorkspaceChannel(id uuid.UUID) string {
1153-
return fmt.Sprintf("workspace:%s", id)
1154-
}
1155-
11561152
func (api *API) publishWorkspaceUpdate(ctx context.Context, workspaceID uuid.UUID) {
1157-
err := api.Pubsub.Publish(watchWorkspaceChannel(workspaceID), []byte{})
1153+
err := api.Pubsub.Publish(codersdk.WorkspaceNotifyChannel(workspaceID), []byte{})
11581154
if err != nil {
11591155
api.Logger.Warn(ctx, "failed to publish workspace update",
11601156
slog.F("workspace_id", workspaceID), slog.Error(err))

0 commit comments

Comments
 (0)