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)
53
53
FirestoreInternal::FirestoreInternal (
54
54
App* app, std::unique_ptr<CredentialsProvider> credentials)
55
55
: 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 ))) {
57
59
ApplyDefaultSettings ();
58
60
}
59
61
@@ -130,8 +132,7 @@ Future<void> FirestoreInternal::RunTransaction(TransactionFunction* update) {
130
132
131
133
Future<void > FirestoreInternal::RunTransaction (
132
134
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_;
135
136
auto promise =
136
137
promise_factory_.CreatePromise <void >(AsyncApi::kRunTransaction );
137
138
Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ class Transaction;
27
27
class TransactionFunction ;
28
28
class WriteBatch ;
29
29
30
+ namespace util {
31
+ class Executor ;
32
+ }
33
+
30
34
class FirestoreInternal {
31
35
public:
32
36
// Note: call `set_firestore_public` immediately after construction.
@@ -145,6 +149,8 @@ class FirestoreInternal {
145
149
// TODO(b/136119216): revamp this mechanism on both iOS and Android.
146
150
std::mutex listeners_mutex_;
147
151
std::unordered_set<ListenerRegistrationInternal*> listeners_;
152
+
153
+ std::shared_ptr<util::Executor> transaction_executor_;
148
154
};
149
155
150
156
} // namespace firestore
You can’t perform that action at this time.
0 commit comments