Print advice and exit(0) on job result timeout
It's also not necessarily the case that a job failed if the client
timed out waiting for the result. However, unlike waiting for syncs,
you probably _do_ want to fail a script, because the outcome is
unknown.
@@ -19,6 +19,14 @@ var ErrTimeout = errors.New("timeout")
func await(ctx context.Context, stdout, stderr io.Writer, client api.Server, jobID job.ID, apply bool, verbosity int) error {
result, err := awaitJob(ctx, client, jobID)
if err != nil {
+ if err == ErrTimeout {
+ fmt.Fprintln(stderr, `
+We timed out waiting for the result of the operation. This does not
+necessarily mean it has failed. You can check the state of the
+cluster, or commit logs, to see if there was a result. In general, it
+is safe to retry operations.`)
+ // because the outcome is unknown, still return the err to indicate an exceptional exit
+ }
return err
}
if result.Result != nil {
