mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: Tidy up closes for nicer output (#4605)
* fix: Tidy up closes for nicer output There was a context canceled message that would appear because of traces, and this was using the wrong close. I don't think it was causing any specific problems, but it could make a replica warning appear on restart. * Fix migration and experimental
This commit is contained in:
+2
-1
@@ -609,7 +609,8 @@ func (h *headerTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
|
||||
// ExperimentalEnabled returns if the experimental feature flag is enabled.
|
||||
func ExperimentalEnabled(cmd *cobra.Command) bool {
|
||||
return cliflag.IsSetBool(cmd, varExperimental)
|
||||
enabled, _ := cmd.Flags().GetBool(varExperimental)
|
||||
return enabled
|
||||
}
|
||||
|
||||
// EnsureExperimental will ensure that the experimental feature flag is set if the given flag is set.
|
||||
|
||||
+3
-4
@@ -476,14 +476,13 @@ func Server(dflags *codersdk.DeploymentFlags, newAPI func(context.Context, *code
|
||||
), dflags.PromAddress.Value, "prometheus")()
|
||||
}
|
||||
|
||||
// We use a separate closer so the Enterprise API
|
||||
// We use a separate coderAPICloser so the Enterprise API
|
||||
// can have it's own close functions. This is cleaner
|
||||
// than abstracting the Coder API itself.
|
||||
coderAPI, closer, err := newAPI(ctx, options)
|
||||
coderAPI, coderAPICloser, err := newAPI(ctx, options)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer.Close()
|
||||
|
||||
client := codersdk.New(localURL)
|
||||
if dflags.TLSEnable.Value {
|
||||
@@ -663,7 +662,7 @@ func Server(dflags *codersdk.DeploymentFlags, newAPI func(context.Context, *code
|
||||
wg.Wait()
|
||||
|
||||
cmd.Println("Waiting for WebSocket connections to close...")
|
||||
_ = coderAPI.Close()
|
||||
_ = coderAPICloser.Close()
|
||||
cmd.Println("Done waiting for WebSocket connections")
|
||||
|
||||
// Close tunnel after we no longer have in-flight connections.
|
||||
|
||||
Reference in New Issue
Block a user