no more lock update needed

all these things are idempodent now
This commit is contained in:
Bryan Stitt 2023-07-09 22:51:01 -07:00
parent af4ca0f450
commit 9ee6b18172
2 changed files with 3 additions and 8 deletions

@ -24,10 +24,8 @@ use hashbrown::{HashMap, HashSet};
use http::StatusCode;
use migration::sea_orm::prelude::Decimal;
use migration::sea_orm::{
self, ActiveModelTrait, ColumnTrait, EntityTrait, ModelTrait, QueryFilter, QuerySelect,
TransactionTrait,
self, ActiveModelTrait, ColumnTrait, EntityTrait, ModelTrait, QueryFilter, TransactionTrait,
};
use migration::LockType;
use payment_contracts::ierc20::IERC20;
use payment_contracts::payment_factory::{self, PaymentFactory};
use serde_json::json;
@ -232,7 +230,6 @@ pub async fn user_balance_post(
// check for uncles
let mut find_uncles = increase_on_chain_balance_receipt::Entity::find()
.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));
@ -496,7 +493,6 @@ 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(LockType::Update)
.filter(increase_on_chain_balance_receipt::Column::BlockHash.eq(uncle_hash.encode_hex()))
.all(&txn)
.await?

@ -20,9 +20,9 @@ use influxdb2::models::DataPoint;
use migration::sea_orm::prelude::Decimal;
use migration::sea_orm::{
self, ActiveModelTrait, ColumnTrait, DatabaseConnection, DbConn, EntityTrait, IntoActiveModel,
QueryFilter, QuerySelect, TransactionTrait,
QueryFilter, TransactionTrait,
};
use migration::{Expr, LockType, OnConflict};
use migration::{Expr, OnConflict};
use num_traits::ToPrimitive;
use parking_lot::Mutex;
use std::borrow::Cow;
@ -426,7 +426,6 @@ impl BufferedRpcQueryStats {
match referee::Entity::find()
.filter(referee::Column::UserId.eq(sender_user_id))
.find_also_related(referrer::Entity)
.lock(LockType::Update)
.one(&txn)
.await?
{