Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Bug] Fix Document.Get behavior to send unary gRPC request instead of setting up a Listen stream for Document updates

Aperta
#1,700 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
cpp, grpc

Direzione di ricerca

Inizia in firestore/src/main/document_reference_main.cc, in DocumentReferenceInternal::Get, e segui l’implementazione dell’API Firestore referenziata. Verifica come vengono selezionati GetDocument e il percorso Listen, quindi verifica che Get() utilizzi una richiesta unaria e restituisca ancora il primo DocumentSnapshot previsto senza aprire uno stream Listen.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

api: firestore new type: question
[REQUIRED] Please fill in the following fields:
  • Pre-built SDK from the website or open-source from this repo: _____
  • Firebase C++ SDK version: unity-v11.8.0 onwards
  • Problematic Firebase Component: Firestore Database API
  • Other Firebase Components in use: N/A
  • Platform you are using the C++ SDK on: Linux (but exists on all platforms)
  • Platform you are targeting: desktop
[REQUIRED] Please describe the issue here:

The Firestore C++ Mobile SDK API implementation for DocumentReference.Get() is sub-optimal. Instead a sending a single gRPC request for Firestore.GetDocument, it opens a Firestore.Listen stream to listen for DocumentSnapshots and serves the first snapshot as response to the Get() call.

At minimum, this has latency impact - cost of setting up and tearing down a Listen stream is higher and using it to only read first version of the DocumentSnapshot, the cost is not amortized. Arguably, this may even be construed as incorrect behavior if one were to look at the network messages generated by these calls by this implementation as it deviates from the intent of the Firestore API.

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase C++ quickstarts ?
What's the issue repro rate? (eg 100%, 1/5 etc)

100%. Using the DocumentReference.Get() API.

What happened? How can we make the problem occur?
This could be a description, log/console output, etc.

If you have a downloadable sample project that reproduces the bug you're reporting, you will
likely receive a faster response on your issue.

Relevant Code:

https://github.com/firebase/firebase-cpp-sdk/blob/5fead53b4e57ed355c40dd313634a91dd51c3671/firestore/src/main/document_reference_main.cc#L59

// Get should send a unary RPC - not a Streaming Listen RPC
Future<DocumentSnapshot> DocumentReferenceInternal::Get(Source source) {
  auto promise =
      promise_factory_.CreatePromise<DocumentSnapshot>(AsyncApis::kGet);
  auto listener = ListenerWithPromise<api::DocumentSnapshot>(promise);
  reference_.GetDocument(ToCoreApi(source), std::move(listener));
  return promise.future();
}
Lingua principale
C++
Stelle
326
Fork
138
Merge medio
1g 22h
PR unite (30g)
6

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di firebase/firebase-cpp-sdk

Tutte le issue di firebase/firebase-cpp-sdk

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.