Use existing context

This commit is contained in:
David Gardiner 2022-09-29 09:58:44 -07:00
parent 35d2cf30d0
commit 766e6a2314
2 changed files with 3 additions and 3 deletions

View file

@ -89,8 +89,8 @@ func (g *Client) appendMetadata(ctx context.Context) context.Context {
}
// Starts a remote JupyterLab server to allow the user to connect to the codespace via JupyterLab in their browser
func (g *Client) StartJupyterServer() (port int, serverUrl string, err error) {
ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
func (g *Client) StartJupyterServer(ctx context.Context) (port int, serverUrl string, err error) {
ctx, cancel := context.WithTimeout(ctx, requestTimeout)
ctx = g.appendMetadata(ctx)
defer cancel()

View file

@ -51,7 +51,7 @@ func (a *App) Jupyter(ctx context.Context, codespaceName string) (err error) {
defer safeClose(client, &err)
a.StartProgressIndicatorWithLabel("Starting JupyterLab on codespace")
serverPort, serverUrl, err := client.StartJupyterServer()
serverPort, serverUrl, err := client.StartJupyterServer(ctx)
a.StopProgressIndicator()
if err != nil {
return fmt.Errorf("failed to start JupyterLab server: %w", err)