Skip to content

Commit ec69bcc

Browse files
committed
Standardize on workspace channel function
1 parent 970a829 commit ec69bcc

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
@@ -956,7 +956,7 @@ func (api *API) watchWorkspace(rw http.ResponseWriter, r *http.Request) {
956956
})
957957
}
958958

959-
cancelWorkspaceSubscribe, err := api.Pubsub.Subscribe(watchWorkspaceChannel(workspace.ID), sendUpdate)
959+
cancelWorkspaceSubscribe, err := api.Pubsub.Subscribe(codersdk.WorkspaceNotifyChannel(workspace.ID), sendUpdate)
960960
if err != nil {
961961
_ = sendEvent(ctx, codersdk.ServerSentEvent{
962962
Type: codersdk.ServerSentEventTypeError,
@@ -1243,12 +1243,8 @@ func validWorkspaceSchedule(s *string) (sql.NullString, error) {
12431243
}, nil
12441244
}
12451245

1246-
func watchWorkspaceChannel(id uuid.UUID) string {
1247-
return fmt.Sprintf("workspace:%s", id)
1248-
}
1249-
12501246
func (api *API) publishWorkspaceUpdate(ctx context.Context, workspaceID uuid.UUID) {
1251-
err := api.Pubsub.Publish(watchWorkspaceChannel(workspaceID), []byte{})
1247+
err := api.Pubsub.Publish(codersdk.WorkspaceNotifyChannel(workspaceID), []byte{})
12521248
if err != nil {
12531249
api.Logger.Warn(ctx, "failed to publish workspace update",
12541250
slog.F("workspace_id", workspaceID), slog.Error(err))

0 commit comments

Comments
 (0)