Commit 135d720
committed
fix: respect AbortSignal in run() - throw on pre-aborted and mid-poll abort
run() ignores AbortSignal in two ways:
1. If signal is already aborted before calling run(), the prediction
starts anyway instead of throwing immediately
2. If signal becomes aborted during polling, run() cancels the
prediction but returns the result instead of throwing AbortError
Now checks signal.aborted before starting the prediction and throws
AbortError after cancellation instead of silently returning output.
The cancel call is wrapped in catch to handle cases where the
prediction already completed on Replicate's servers.
Fixes #3701 parent 2fd6f39 commit 135d720
1 file changed
+11
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
148 | 155 | | |
149 | 156 | | |
150 | 157 | | |
| |||
191 | 198 | | |
192 | 199 | | |
193 | 200 | | |
194 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
195 | 205 | | |
196 | 206 | | |
197 | 207 | | |
| |||
0 commit comments