Skip to content

Commit 268a50c

Browse files
authored
feat(agent/agentcontainers): add file watcher and dirty status (coder#17573)
Fixes coder/internal#479 Fixes coder/internal#480
1 parent b6146df commit 268a50c

File tree

12 files changed

+909
-47
lines changed

12 files changed

+909
-47
lines changed

agent/agent.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1481,8 +1481,13 @@ func (a *agent) createTailnet(
14811481
}()
14821482
if err = a.trackGoroutine(func() {
14831483
defer apiListener.Close()
1484+
apiHandler, closeAPIHAndler := a.apiHandler()
1485+
defer func() {
1486+
_ = closeAPIHAndler()
1487+
}()
14841488
server := &http.Server{
1485-
Handler: a.apiHandler(),
1489+
BaseContext: func(net.Listener) context.Context { return ctx },
1490+
Handler: apiHandler,
14861491
ReadTimeout: 20 * time.Second,
14871492
ReadHeaderTimeout: 20 * time.Second,
14881493
WriteTimeout: 20 * time.Second,
@@ -1493,6 +1498,7 @@ func (a *agent) createTailnet(
14931498
case <-ctx.Done():
14941499
case <-a.hardCtx.Done():
14951500
}
1501+
_ = closeAPIHAndler()
14961502
_ = server.Close()
14971503
}()
14981504

0 commit comments

Comments
 (0)