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

Commit3485300

Browse files
authored
fix(coderd): Ensure agent disconnect happens after timeout (#6600)
Fixes#6598
1 parent7587850 commit3485300

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

‎coderd/coderd.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ func New(options *Options) *API {
175175
ifoptions.AgentInactiveDisconnectTimeout==0 {
176176
// Multiply the update by two to allow for some lag-time.
177177
options.AgentInactiveDisconnectTimeout=options.AgentConnectionUpdateFrequency*2
178+
// Set a minimum timeout to avoid disconnecting too soon.
179+
ifoptions.AgentInactiveDisconnectTimeout<2*time.Second {
180+
options.AgentInactiveDisconnectTimeout=2*time.Second
181+
}
178182
}
179183
ifoptions.AgentStatsRefreshInterval==0 {
180184
options.AgentStatsRefreshInterval=5*time.Minute

‎coderd/workspaceagents.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ func (api *API) workspaceAgentCoordinate(rw http.ResponseWriter, r *http.Request
615615

616616
// We use a custom heartbeat routine here instead of `httpapi.Heartbeat`
617617
// because we want to log the agent's last ping time.
618-
varlastPing time.Time
618+
lastPing:=time.Now()// Since the agent initiated the request, assume it's alive.
619619
varpingMu sync.Mutex
620620
gopprof.Do(ctx,pprof.Labels("agent",workspaceAgent.ID.String()),func(ctx context.Context) {
621621
// TODO(mafredri): Is this too frequent? Use separate ping disconnect timeout?

‎scaletest/reconnectingpty/run_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323

2424
funcTest_Runner(t*testing.T) {
2525
t.Parallel()
26-
t.Skip("https://github.com/coder/coder/issues/6598")
2726

2827
t.Run("OK",func(t*testing.T) {
2928
t.Parallel()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp