-
Notifications
You must be signed in to change notification settings - Fork 1.6k
runTransactionBlock works wrong in offline mode #18
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
Comments
Any comments? By the way it seems the same behavior on FirebaseDatabase version 3.1.2. |
Can you tell us how you are running the transactions multiple times? Do you wait for the transactions to complete before running them again? It would also help to get debug output from your app. As one of the first lines in your app, please set "Database.setLoggingEnabled(true)". You also need to pass -FIRDebugEnabled to your app to make the logs appear. |
Yes, application runs multiple transactions one after another. And no, application doesn't wait for transaction completion before running the next one because it's called only in online mode. Do you mean that it's not possible to use multiple runTransactionBlock in offline? I didn't see such limitations in the documentation but maybe I have missed that. I will try to send log a little bit later. |
You can use multiple transactions when offline, but it changes the way we run them and if there is a race on the same database location, some transactions can get cancelled. I will be able to tell what's going on from the logs. |
@schmidt-sebastian It's strange but I cannot reproduce it now, maybe it was my mistake somewhere. So the issue can be closed at least for now. |
Thanks for following up @ab-rdarts. If this issue resurfaces in the future, please reopen this ticket. |
It's strange but I have the same problem with transaction during online |
@schmidt-sebastian any comments about attached log? |
Closing this due to inactivity. Please re-open if this is still an issue. |
Uh oh!
There was an error while loading. Please reload this page.
[READ] Step 1: Are you in the right place?
Not sure
[REQUIRED] Step 2: Describe your environment
Xcode version: 8.3.2
Firebase SDK version: 4.0.0
Library version: 4.0.0
Firebase Product: database
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
initial count value in database is 0
application started and wifi connection is switched off
application performs two calls to runTransactionBlock which increases counter by 1. database value is still 0 as expected
it works fine locally
now wifi connection is switched on
runTransaction successfully committed two values, but database value equals to 1
EXPECTED: database value should be equal to 2
please note that if runTransactionBlock called in offline 7 times than server value is 6 instead of 7.
Relevant Code:
offline output:
"FB BEFORE FIRMutableData (top-most transaction) (null) 0"
"FB AFTER FIRMutableData (top-most transaction) (null) 1"
"FB BEFORE FIRMutableData (top-most transaction) (null) 1"
"FB AFTER FIRMutableData (top-most transaction) (null) 2"
online output:
"FB BEFORE FIRMutableData (top-most transaction) (null) 0"
"FB AFTER FIRMutableData (top-most transaction) (null) 1"
"FB COMMITTED Optional(Snap (contributed) 1)"
"FB COMMITTED Optional(Snap (contributed) 1)"
The text was updated successfully, but these errors were encountered: