Skip to content

Commit d8cd584

Browse files
committed
review
1 parent 4fb878d commit d8cd584

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

coderd/agentapi/logs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func (a *LogsAPI) BatchCreateLogs(ctx context.Context, req *agentproto.BatchCrea
144144
if workspaceAgent.LogsLength == 0 && a.PublishWorkspaceUpdateFn != nil {
145145
// If these are the first logs being appended, we publish a UI update
146146
// to notify the UI that logs are now available.
147-
err = a.PublishWorkspaceUpdateFn(ctx, &workspaceAgent, wspubsub.WorkspaceEventKindAgentLogsUpdate)
147+
err = a.PublishWorkspaceUpdateFn(ctx, &workspaceAgent, wspubsub.WorkspaceEventKindAgentFirstLogs)
148148
if err != nil {
149149
return nil, xerrors.Errorf("publish workspace update: %w", err)
150150
}

coderd/workspaceagents.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func (api *API) patchWorkspaceAgentLogs(rw http.ResponseWriter, r *http.Request)
252252
}
253253

254254
api.publishWorkspaceUpdate(ctx, workspace.Workspace.OwnerID, wspubsub.WorkspaceEvent{
255-
Kind: wspubsub.WorkspaceEventKindAgentLogsUpdate,
255+
Kind: wspubsub.WorkspaceEventKindAgentLogsOverflow,
256256
WorkspaceID: workspace.Workspace.ID,
257257
AgentID: &workspaceAgent.ID,
258258
})
@@ -284,7 +284,7 @@ func (api *API) patchWorkspaceAgentLogs(rw http.ResponseWriter, r *http.Request)
284284
}
285285

286286
api.publishWorkspaceUpdate(ctx, workspace.Workspace.OwnerID, wspubsub.WorkspaceEvent{
287-
Kind: wspubsub.WorkspaceEventKindAgentLogsUpdate,
287+
Kind: wspubsub.WorkspaceEventKindAgentFirstLogs,
288288
WorkspaceID: workspace.Workspace.ID,
289289
AgentID: &workspaceAgent.ID,
290290
})

coderd/workspaces.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,9 +1724,7 @@ func (api *API) watchWorkspace(rw http.ResponseWriter, r *http.Request) {
17241724
defer cancelWorkspaceSubscribe()
17251725

17261726
// This is required to show whether the workspace is up-to-date.
1727-
cancelTemplateSubscribe, err := api.Pubsub.Subscribe(watchTemplateChannel(workspace.TemplateID), func(ctx context.Context, msg []byte) {
1728-
sendUpdate(ctx, nil)
1729-
})
1727+
cancelTemplateSubscribe, err := api.Pubsub.Subscribe(watchTemplateChannel(workspace.TemplateID), sendUpdate)
17301728
if err != nil {
17311729
_ = sendEvent(ctx, codersdk.ServerSentEvent{
17321730
Type: codersdk.ServerSentEventTypeError,

coderd/wspubsub/wspubsub.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ const (
4949
WorkspaceEventKindAppHealthUpdate WorkspaceEventKind = "app_health"
5050

5151
WorkspaceEventKindAgentLifecycleUpdate WorkspaceEventKind = "agt_lifecycle_update"
52-
WorkspaceEventKindAgentLogsUpdate WorkspaceEventKind = "agt_logs_update"
5352
WorkspaceEventKindAgentConnectionUpdate WorkspaceEventKind = "agt_connection_update"
53+
WorkspaceEventKindAgentFirstLogs WorkspaceEventKind = "agt_first_logs"
5454
WorkspaceEventKindAgentLogsOverflow WorkspaceEventKind = "agt_logs_overflow"
5555
WorkspaceEventKindAgentTimeout WorkspaceEventKind = "agt_timeout"
5656
)

0 commit comments

Comments
 (0)