Skip to content

Commit

Permalink
Added blocking with Firebase sample to prevent race conditions during…
Browse files Browse the repository at this point in the history
… tests. (#925)
  • Loading branch information
kurtisvg authored Nov 21, 2017
1 parent 2042a94 commit fcf959d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ public Void updateCallback(Transaction transaction) throws Exception {
String returnInfoFromTransaction(long population) throws Exception {
Map<String, Object> map = new HashMap<>();
map.put("population", population);
db.collection("cities").document("SF").set(map);
// Block until transaction is complete is using transaction.get()
db.collection("cities").document("SF").set(map).get();
// [START fs_return_info_transaction]
final DocumentReference docRef = db.collection("cities").document("SF");
ApiFuture<String> transaction =
Expand Down

0 comments on commit fcf959d

Please sign in to comment.