Skip to content

Commit 1620ec6

Browse files
authored
Fix behavior of run when wait is set (#87)
1 parent 6e28593 commit 1620ec6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

run.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,14 @@ func (r *Client) RunWithOptions(ctx context.Context, identifier string, input Pr
8282
return nil, err
8383
}
8484

85-
// Wait for the prediction to complete
86-
err = r.Wait(ctx, prediction)
87-
if err != nil {
88-
return nil, err
85+
// Check if the prediction is done based on blocking preference and status
86+
isDone := options.blockUntilDone && prediction.Status != Starting
87+
if !isDone {
88+
// Wait for the prediction to complete
89+
err = r.Wait(ctx, prediction)
90+
if err != nil {
91+
return nil, err
92+
}
8993
}
9094

9195
// Check for model error in the prediction

0 commit comments

Comments
 (0)