File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
native/swift/Sources/wordpress-api Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -188,9 +188,13 @@ public actor WordPressAPI {
188
188
return try await withTaskCancellationHandler {
189
189
try await uploadTask. value
190
190
} onCancel: {
191
- // Please note: for some reason calling `uploadTask.cancel()` here does not actually cancel
192
- // the HTTP request. But calling `progress.cancel()` does, even though `progress.cancel()` eventually
193
- // calls `uploadTask.cancel()`.
191
+ // Please note: the async functions exported by uniffi-rs _do not_ support cancellation.
192
+ // That means cancelling an API call like `Task { try await api.users.retrieveMe() }.cancel()`
193
+ // does not cancel the underlying HTTP request sent by URLSession.
194
+ //
195
+ // The `progress.cancel()` in this particular function can cancel the HTTP request, because the
196
+ // `progress` instance is the parent progress of `URLSessionTask.progress`, and cancelling a parent
197
+ // progress automatically cancels their child progress, which is the `URLSessionTask` in this case.
194
198
progress. cancel ( )
195
199
}
196
200
}
You can’t perform that action at this time.
0 commit comments