Skip to content

Commit

Permalink
show message when waiting
Browse files Browse the repository at this point in the history
  • Loading branch information
pmenglund committed Nov 6, 2023
1 parent 1397cb0 commit b0425da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
12 changes: 5 additions & 7 deletions cmd/query_lambda.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,13 @@ func newCreateQueryLambdaCmd() *cobra.Command {
if err != nil {
return err
}
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "created query lambda %s.%s:%s\n",
ql.GetWorkspace(), ql.GetName(), ql.GetVersion())

if err = waitUntilQLActive(rs, cmd, ws, args[0], ql.GetVersion()); err != nil {
return err
}

_, _ = fmt.Fprintf(cmd.OutOrStdout(), "created query lambda %s.%s:%s\n",
ql.GetWorkspace(), ql.GetName(), ql.GetVersion())

return nil
},
}
Expand Down Expand Up @@ -337,14 +336,13 @@ func newUpdateQueryLambdaCmd() *cobra.Command {
if err != nil {
return err
}
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "updated query lambda %s.%s:%s",
ql.GetWorkspace(), ql.GetName(), ql.GetVersion())

if err = waitUntilQLActive(rs, cmd, ws, args[0], ql.GetVersion()); err != nil {
return err
}

_, _ = fmt.Fprintf(cmd.OutOrStdout(), "updated query lambda %s.%s:%s",
ql.GetWorkspace(), ql.GetName(), ql.GetVersion())

return nil
},
}
Expand All @@ -367,7 +365,7 @@ func waitUntilQLActive(rs *rockset.RockClient, cmd *cobra.Command, ws, name, ver
return err
}
if wait {
// TODO notify the user that we're waiting
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "waiting until query lambda is ready...")
if err := rs.Wait.UntilQueryLambdaVersionActive(cmd.Context(), ws, name, version); err != nil {

Check failure on line 369 in cmd/query_lambda.go

View workflow job for this annotation

GitHub Actions / test

rs.Wait.UntilQueryLambdaVersionActive undefined (type *wait.Waiter has no field or method UntilQueryLambdaVersionActive)
return fmt.Errorf("failed to wait for %s.%s:%s to be active: %v", ws, name, version, err)
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/virtual_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ func newCreateVirtualInstanceCmd() *cobra.Command {
if err != nil {
return err
}
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "virtual instance '%s' created\n", result.GetName())

if err = waitUntilVIActive(rs, cmd, result.GetId()); err != nil {
return err
}

_, _ = fmt.Fprintf(cmd.OutOrStdout(), "virtual instance '%s' created\n", result.GetName())
return nil
},
}
Expand Down Expand Up @@ -100,12 +100,12 @@ func newUpdateVirtualInstanceCmd() *cobra.Command {
if err != nil {
return err
}
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "virtual instance '%s' updated\n", result.GetName())

if err = waitUntilVIActive(rs, cmd, result.GetId()); err != nil {
return err
}

_, _ = fmt.Fprintf(cmd.OutOrStdout(), "virtual instance '%s' updated\n", result.GetName())
return nil
},
}
Expand Down Expand Up @@ -291,13 +291,12 @@ func newResumeVirtualInstanceCmd() *cobra.Command {
if err != nil {
return err
}
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "virtual instance '%s' resumed\n", result.GetName())

if err = waitUntilVIActive(rs, cmd, id); err != nil {
return err
}

_, _ = fmt.Fprintf(cmd.OutOrStdout(), "virtual instance '%s' resumed\n", result.GetName())

return nil
},
}
Expand Down Expand Up @@ -350,7 +349,8 @@ func waitUntilVIActive(rs *rockset.RockClient, cmd *cobra.Command, vID string) e
return err
}
if wait {
// TODO notify the user that we're waiting
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "waiting for virtual instance to be ready...\n")

if err := rs.Wait.UntilVirtualInstanceActive(cmd.Context(), vID); err != nil {
return fmt.Errorf("failed to wait for %s to be active: %v", vID, err)
}
Expand Down

0 comments on commit b0425da

Please sign in to comment.