firebase / firebase/quickstart-unity

FR: Firestore.SetAsync() should taken a Cancellation Token similar to Storage methods.

Open
#907 4 comments 0 reactions 1 assignee Claimed by @dconeybe View on GitHub
api: firestore type: feature request
Dominant language
C#
Stars
923
Forks
456
PR merge metrics
No merged PRs in 30d

Description

### Feature proposal

* Firebase Component: Firestore

Firestore should have a flavor of the `SetAsync()` call that can accept a cancellationToken, ideally similar to Storage's counterparts, like `PutFileAsync()`.

`SetAsync(
object documentData,
SetOptions options,
CancellationToken cancelToken
)
`

Though a Firestore Get/Set/Update operation is usually quite quick, I've had times where there is some waiting because of spotty internet connections, or which appear to have failed silently (no isFault or cancellation). In these cases, the wait time can potentially be quite long, and a user (or a timeout I set up) should be able to cancel out.

A side note is that within the **quickstart-unity** project, the Firestore example is set up with the same structure as Storage, with a cancellationTokenSource. But within the Storage example, the cancellationTokenSource.Cancel() [is connected to the Task](https://github.com/firebase/quickstart-unity/blob/241b0e5f527fb0b2088709a16e747d080853ca89/storage/testapp/Assets/Firebase/Sample/Storage/UIHandler.cs#L241) generated by the Storage API call, but in Firestore there is a similar cancellationTokenSource but without anything in the SetAsync() to connect it up with. I can't find where it has any effect. And I wouldn't be at all surprised if I'm missing something clever 😅

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.