-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Hi guys, I have this weird issue with 1.0.0-BETA28, and I would greatly appreciate any help in debugging it.
Scenario:
- An expense logging screen of an Android app is opened via a desktop shortcut
- User selects account and enters the amount
- A
writeTransaction
is executed inviewModelScope
which contains the following queries:- INSERT new row into the transfers table
- SELECT current account balance from the accounts table (stored as TEXT and mapped into BigInteger)
- UPDATE the accounts table, set corresponding account balance to current - transfer amount
- Once
writeTransaction
is completed successfully, the screen closes and so the app goes to background
The issue: sometimes the balance UPDATE is not applied, although the new row gets inserted into the transfers table within the same transaction.
On the other hand, if the same expense logging is done from the main app screen, so the app doesn't go to background on transaction success, the UPDATE is always applied, and the user immediately sees the updated value in the UI (via database.watch()
)
Here is the log for the case when UPDATE has not been applied:
There's a big time difference between 21:43:11.616 and 21:43:27.738 because I actually managed to suspend the SupabaseConnector
by a breakpoint to confirm that table.update
was indeed called with entry.opData
having "balance=-4314082". Nevertheless, the balance in Supabase remained the same, and so it did in the app.