Skip to content

Commit fd2c0d1

Browse files
committed
decrease ssh shutdown timeout
1 parent 918f2dc commit fd2c0d1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

agent/agent.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -1773,10 +1773,12 @@ func (a *agent) Close() error {
17731773
a.setLifecycle(codersdk.WorkspaceAgentLifecycleShuttingDown)
17741774

17751775
// Attempt to gracefully shut down all active SSH connections and
1776-
// stop accepting new ones. If all processes have not exited after
1777-
// 10 seconds, we just log it and move on as it's more important
1778-
// to run the shutdown scripts.
1779-
sshShutdownCtx, sshShutdownCancel := context.WithTimeout(a.hardCtx, 10*time.Second)
1776+
// stop accepting new ones. If all processes have not exited after 5
1777+
// seconds, we just log it and move on as it's more important to run
1778+
// the shutdown scripts. A typical shutdown time for containers is
1779+
// 10 seconds, so this still leaves a bit of time to run the
1780+
// shutdown scripts in the worst-case.
1781+
sshShutdownCtx, sshShutdownCancel := context.WithTimeout(a.hardCtx, 5*time.Second)
17801782
defer sshShutdownCancel()
17811783
err := a.sshServer.Shutdown(sshShutdownCtx)
17821784
if err != nil {

0 commit comments

Comments
 (0)