Skip to content

Commit fa41a8a

Browse files
committed
review
1 parent 365f7f4 commit fa41a8a

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
@@ -253,7 +253,7 @@ func (api *API) patchWorkspaceAgentLogs(rw http.ResponseWriter, r *http.Request)
253253
}
254254

255255
api.publishWorkspaceUpdate(ctx, workspace.Workspace.OwnerID, wspubsub.WorkspaceEvent{
256-
Kind: wspubsub.WorkspaceEventKindAgentLogsUpdate,
256+
Kind: wspubsub.WorkspaceEventKindAgentLogsOverflow,
257257
WorkspaceID: workspace.Workspace.ID,
258258
AgentID: &workspaceAgent.ID,
259259
})
@@ -285,7 +285,7 @@ func (api *API) patchWorkspaceAgentLogs(rw http.ResponseWriter, r *http.Request)
285285
}
286286

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

coderd/workspaces.go

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

17001700
// This is required to show whether the workspace is up-to-date.
1701-
cancelTemplateSubscribe, err := api.Pubsub.Subscribe(watchTemplateChannel(workspace.TemplateID), func(ctx context.Context, msg []byte) {
1702-
sendUpdate(ctx, nil)
1703-
})
1701+
cancelTemplateSubscribe, err := api.Pubsub.Subscribe(watchTemplateChannel(workspace.TemplateID), sendUpdate)
17041702
if err != nil {
17051703
_ = sendEvent(ctx, codersdk.ServerSentEvent{
17061704
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)