switch the lock type (#165)
This commit is contained in:
parent
4a32ce0a19
commit
cf3d984548
@ -21,6 +21,7 @@ use ethers::abi::AbiEncode;
|
||||
use ethers::types::{Address, Block, TransactionReceipt, TxHash, H256};
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
use http::StatusCode;
|
||||
use migration::LockType;
|
||||
use migration::sea_orm::prelude::Decimal;
|
||||
use migration::sea_orm::{
|
||||
self, ActiveModelTrait, ActiveValue, ColumnTrait, EntityTrait, IntoActiveModel, ModelTrait,
|
||||
@ -236,7 +237,7 @@ pub async fn user_balance_post(
|
||||
|
||||
// check for uncles
|
||||
let mut find_uncles = increase_on_chain_balance_receipt::Entity::find()
|
||||
// .lock_exclusive()
|
||||
.lock(LockType::Update)
|
||||
.filter(increase_on_chain_balance_receipt::Column::TxHash.eq(tx_hash.encode_hex()))
|
||||
.filter(increase_on_chain_balance_receipt::Column::ChainId.eq(app.config.chain_id));
|
||||
|
||||
@ -526,7 +527,7 @@ pub async fn handle_uncle_block(
|
||||
|
||||
// delete any deposit txids with uncle_hash
|
||||
for reversed_deposit in increase_on_chain_balance_receipt::Entity::find()
|
||||
.lock_exclusive()
|
||||
.lock(LockType::Update)
|
||||
.filter(increase_on_chain_balance_receipt::Column::BlockHash.eq(uncle_hash.encode_hex()))
|
||||
.all(&txn)
|
||||
.await?
|
||||
@ -545,7 +546,7 @@ pub async fn handle_uncle_block(
|
||||
|
||||
for (user_id, reversed_balance) in reversed_balances.iter() {
|
||||
if let Some(user_balance) = balance::Entity::find()
|
||||
.lock_exclusive()
|
||||
.lock(LockType::Update)
|
||||
.filter(balance::Column::Id.eq(*user_id))
|
||||
.one(&txn)
|
||||
.await?
|
||||
|
Loading…
Reference in New Issue
Block a user