chore: Implement workspace proxy going away (graceful shutdown) (#7459)

* chore: Implement workspace proxy going away

When a workspace proxy shuts down, the health status of that
proxy should immediately be updated. This is purely a courtesy
and technically not required
This commit is contained in:
Steven Masley
2023-05-10 19:23:16 -05:00
committed by GitHub
parent a42a36a474
commit b7f4f3a771
13 changed files with 202 additions and 24 deletions

View File

@ -113,6 +113,7 @@ func New(ctx context.Context, options *Options) (*API, error) {
)
r.Post("/issue-signed-app-token", api.workspaceProxyIssueSignedAppToken)
r.Post("/register", api.workspaceProxyRegister)
r.Post("/goingaway", api.workspaceProxyGoingAway)
})
r.Route("/{workspaceproxy}", func(r chi.Router) {
r.Use(
@ -239,7 +240,7 @@ func New(ctx context.Context, options *Options) (*API, error) {
if api.AGPL.Experiments.Enabled(codersdk.ExperimentMoons) {
// Proxy health is a moon feature.
api.ProxyHealth, err = proxyhealth.New(&proxyhealth.Options{
Interval: time.Minute * 1,
Interval: options.ProxyHealthInterval,
DB: api.Database,
Logger: options.Logger.Named("proxyhealth"),
Client: api.HTTPClient,