File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,9 @@ FirestoreInternal::FirestoreInternal(App* app)
5353FirestoreInternal::FirestoreInternal (
5454 App* app, std::unique_ptr<CredentialsProvider> credentials)
5555 : app_(NOT_NULL(app)),
56- firestore_core_ (CreateFirestore(app, std::move(credentials))) {
56+ firestore_core_ (CreateFirestore(app, std::move(credentials))),
57+ transaction_executor_(absl::ShareUniquePtr(Executor::CreateConcurrent(
58+ " com.google.firebase.firestore.transaction" , /* threads=*/ 5 ))) {
5759 ApplyDefaultSettings ();
5860}
5961
@@ -130,8 +132,7 @@ Future<void> FirestoreInternal::RunTransaction(TransactionFunction* update) {
130132
131133Future<void > FirestoreInternal::RunTransaction (
132134 std::function<Error(Transaction&, std::string&)> update) {
133- auto executor = absl::ShareUniquePtr (Executor::CreateConcurrent (
134- " com.google.firebase.firestore.transaction" , /* threads=*/ 5 ));
135+ auto executor = transaction_executor_;
135136 auto promise =
136137 promise_factory_.CreatePromise <void >(AsyncApi::kRunTransaction );
137138
Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ class Transaction;
2727class TransactionFunction ;
2828class WriteBatch ;
2929
30+ namespace util {
31+ class Executor ;
32+ }
33+
3034class FirestoreInternal {
3135 public:
3236 // Note: call `set_firestore_public` immediately after construction.
@@ -145,6 +149,8 @@ class FirestoreInternal {
145149 // TODO(b/136119216): revamp this mechanism on both iOS and Android.
146150 std::mutex listeners_mutex_;
147151 std::unordered_set<ListenerRegistrationInternal*> listeners_;
152+
153+ std::shared_ptr<util::Executor> transaction_executor_;
148154};
149155
150156} // namespace firestore
You can’t perform that action at this time.
0 commit comments