Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit19a8a38

Browse files
committed
added logging to long lived connection opening functions
1 parent422c45c commit19a8a38

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

‎coderd/inboxnotifications.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ func (api *API) watchInboxNotifications(rw http.ResponseWriter, r *http.Request)
219219
encoder:=wsjson.NewEncoder[codersdk.GetInboxNotificationResponse](conn,websocket.MessageText)
220220
deferencoder.Close(websocket.StatusNormalClosure)
221221

222+
// log the initial connection
223+
httpmw.FromContext(ctx).WriteLog(ctx,http.StatusAccepted)
224+
222225
for {
223226
select {
224227
case<-ctx.Done():

‎coderd/provisionerjobs.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,8 @@ func (f *logFollower) follow() {
554554
return
555555
}
556556

557-
// write the initial connection to the logs
558-
httpmw.FromContext(f.ctx).WriteLog(
559-
f.ctx,http.StatusAccepted)
557+
// log the initial connection
558+
httpmw.FromContext(f.ctx).WriteLog(f.ctx,http.StatusAccepted)
560559

561560
// no need to wait if the job is done
562561
iff.complete {

‎coderd/workspaceagents.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,9 @@ func (api *API) workspaceAgentLogs(rw http.ResponseWriter, r *http.Request) {
555555
t:=time.NewTicker(recheckInterval)
556556
defert.Stop()
557557

558+
// log the initial connection
559+
httpmw.FromContext(ctx).WriteLog(ctx,http.StatusAccepted)
560+
558561
gofunc() {
559562
deferfunc() {
560563
logger.Debug(ctx,"end log streaming loop")
@@ -928,6 +931,9 @@ func (api *API) derpMapUpdates(rw http.ResponseWriter, r *http.Request) {
928931
encoder:=wsjson.NewEncoder[*tailcfg.DERPMap](ws,websocket.MessageBinary)
929932
deferencoder.Close(websocket.StatusGoingAway)
930933

934+
// log the initial connection
935+
httpmw.FromContext(ctx).WriteLog(ctx,http.StatusAccepted)
936+
931937
gofunc(ctx context.Context) {
932938
// TODO(mafredri): Is this too frequent? Use separate ping disconnect timeout?
933939
t:=time.NewTicker(api.AgentConnectionUpdateFrequency)
@@ -1315,6 +1321,9 @@ func (api *API) watchWorkspaceAgentMetadata(
13151321
sendTicker:=time.NewTicker(sendInterval)
13161322
defersendTicker.Stop()
13171323

1324+
// log the initial connection
1325+
httpmw.FromContext(ctx).WriteLog(ctx,http.StatusAccepted)
1326+
13181327
// Send initial metadata.
13191328
sendMetadata()
13201329

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp