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

FireStore: Firestore.runTransaction should support asynchronous updateFunction #5196

Closed

Conversation

abhinav-qlogic
Copy link

Fixes #5166

@abhinav-qlogic abhinav-qlogic requested a review from a team as a code owner May 17, 2019 13:46
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 17, 2019
@pmakani pmakani added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 17, 2019
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 17, 2019
@codecov
Copy link

codecov bot commented May 17, 2019

Codecov Report

Merging #5196 into master will decrease coverage by <.01%.
The diff coverage is 22.22%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #5196      +/-   ##
============================================
- Coverage     50.41%   50.41%   -0.01%     
  Complexity    23796    23796              
============================================
  Files          2251     2251              
  Lines        226833   226841       +8     
  Branches      24966    24967       +1     
============================================
+ Hits         114368   114369       +1     
- Misses       103858   103864       +6     
- Partials       8607     8608       +1
Impacted Files Coverage Δ Complexity Δ
...java/com/google/cloud/firestore/FirestoreImpl.java 79.88% <22.22%> (-3.16%) 22 <0> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update db3241b...75d2e20. Read the comment docs.

@@ -352,7 +352,25 @@ public void onSuccess(List<WriteResult> writeResults) {
@Override
public void run() {
try {
callbackResult.set(transactionCallback.updateCallback(transaction));
T callbackValue = transactionCallback.updateCallback(transaction);
if (callbackValue instanceof ApiFuture) {
Copy link
Contributor

@sduskis sduskis May 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong. if T is an ApiFuture, then it's not an ApiFuture<T>, but yet you cast a T to an ApiFuture<T>; that seems like infinite recursion. I would ask that we start over with a design for AsyncFunction which would be cleaner.

This callback gets called within a separate thread anyway. I'm not even sure what AsyncFunction would do for us here.

@sduskis sduskis closed this May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Firestore.runTransaction should support/recognize asynchronous updateFunction result
5 participants