Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix passing abort signal into run method #251

Merged
merged 2 commits into from
May 2, 2024
Merged

Fix passing abort signal into run method #251

merged 2 commits into from
May 2, 2024

Conversation

aron
Copy link
Contributor

@aron aron commented May 2, 2024

This PR fixes two issues with passing the AbortController as a signal option to the replicate.run() method.

Firstly now extract the signal property from the run() options and do not pass on as part of the API body. The backend has recently started validating the body payload so this is now resulting as an API error. This fixes the issue reported in #249.

Secondly, we now call the onProgress handler with the terminal canceled prediction. Previously when aborting a run() request we were dropping the final canceled prediction object and calling the onProgress callback with a stale "processing" object.

I've updated the tests to verify both of these changes.

aron added 2 commits May 2, 2024 12:53
This prevents it being passed to the backend as part of the body. The
backend has recently started validating the body payload so this is now
resulting as an API error.

Fixes #249
Previously when aborting a `run()` request we were dropping the final
canceled prediction object and calling the `onProgress` callback with a
stale "processing" object.
@aron aron requested a review from mattt May 2, 2024 11:57
@aron aron merged commit 9c54b7e into main May 2, 2024
16 checks passed
@aron aron deleted the fix-abort-signal#249 branch May 2, 2024 12:14
@mattt
Copy link
Member

mattt commented May 2, 2024

Nice. Thanks, @aron! Cutting a new patch release with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants