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

issue with delete() followed by listen() #86

Open
tpham3783 opened this issue Mar 25, 2022 · 1 comment
Open

issue with delete() followed by listen() #86

tpham3783 opened this issue Mar 25, 2022 · 1 comment

Comments

@tpham3783
Copy link

Hi,

I am observing an issue with synchronous access between a delete and listen.

take this code for example:

await docRef.delete();

CollectionReference mRef = await cRef.collection("CollectionOfPrevDoc");

/* listen for changes of all docs */
StreamSubscription sub = await mRef.stream.listen((event) {
          // the deleted doc (docRef), would get called back here, 10% of the time, 
          // even though it was deleted using a synchronous call.  
    });

Would someone please advise why this would happen and how to fix it?

@tpham3783 tpham3783 changed the title issue with delete() follow by listen() issue with delete() followed by listen() Mar 25, 2022
@tpham3783
Copy link
Author

I traced down the delete method, and it looks like it is an asynchronous call to grpc:

  Future<void> deleteDocument(String path) => _client
      .deleteDocument(DeleteDocumentRequest()..name = path)
      .catchError(_handleError);

I am not sure how to make that call synchronous, given it is a grpc api.

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

No branches or pull requests

1 participant