How does Bubble handle concurrent database updates?
Consider the following data structure:
Transaction
amount (number)
balance (number)
Account
balance (number)
User
Consider the case where:
- A user submits a Transaction to the database
- A workflow queries the associated users’ Account Balances
- The Transaction amount + Account balance is saved to the Transaction’s balance field as a new running total.
- The Account’s balance field is updated to the new Transaction Balance.
Is it at all possible to prevent stale data in the case where two transactions are submitted simultaneously. If an Account with a zero balance receives two transactions crediting the user +100, both transactions would read the current balance as 0, and update the account balance to 100, instead of 200. Any suggestions here?
Are “Schedule API Workflows” guaranteed to execute in order?
Thanks!