You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here are flows for preventing concurrent transactions to Postgres:
Couple things to be clarified since flows are in sync style:
Pending transaction are always returned, which means client side need to revise feedback message. Client get notices when transaction state has been updated.
Transaction history must includes pending transaction.
Please follow the instruction in each scripts to setup, and then run the script with k6. Like this:
k6 run appreciation.js
k6 run payout.js
k6 run payto.js
Verify result
Appreciation
After rounds of execution, you should see each user can only have 5 appreciations to the article.
Payout
After execution, you should see user's HKD balance is always >= 0 by running SQL:
selectsum("src"."amount") as"amount"from (
selectsum(amount) as amount
from"transaction"where
recipient_id = ${id} and currency ='HKD'and state ='succeeded'unionselectsum((0- amount)) as amount
from"transaction"where
sender_id = ${id} and currency ='HKD'and (state ='succeeded'or state ='pending')
) as src
and list transactions:
select*from"transaction"where"sender_id"= ${id} or"recipient_id"= ${id} order by created_at desc
Pay-to
After running script, you should see users's HKD balance is always >= 0, and transactions might be succeeded or canceled by running SQL queries above.
Here are flows for preventing concurrent transactions to Postgres:
Couple things to be clarified since flows are in sync style:
Any supplementation to those flows? @robertu7 @guoliu
cc @gyuetong
The text was updated successfully, but these errors were encountered: