drop a bunch of log levels

This commit is contained in:
Bryan Stitt 2023-06-16 23:46:20 -07:00
parent 74d2333039
commit 745870d119
8 changed files with 26 additions and 25 deletions

@ -65,7 +65,7 @@ pub async fn query_admin_modify_usertier<'a>(
let caller_id =
get_user_id_from_params(&mut redis_conn, &db_conn, &db_replica, bearer, params).await?;
debug!("Caller id is: {:?}", caller_id);
trace!("Caller id is: {:?}", caller_id);
// Check if the caller is an admin (i.e. if he is in an admin table)
let _admin: admin::Model = admin::Entity::find()

@ -51,8 +51,6 @@ pub async fn serve(
// TODO: latest moka allows for different ttls for different
let response_cache_size = ResponseCacheKey::COUNT;
debug!("response_cache size: {}", response_cache_size);
let response_cache: ResponseCache = CacheBuilder::new(response_cache_size as u64)
.name("frontend_response")
.time_to_live(Duration::from_secs(1))

@ -275,7 +275,7 @@ pub async fn user_login_post(
.await?;
// TODO: emit a stat? if this is high something weird might be happening
debug!("cleared expired pending_logins: {:?}", delete_result);
trace!("cleared expired pending_logins: {:?}", delete_result);
return Err(Web3ProxyError::EipVerificationFailed(
Box::new(err_1),
@ -316,7 +316,7 @@ pub async fn user_login_post(
let txn = db_conn.begin().await?;
// First, optionally catch a referral code from the parameters if there is any
debug!("Refferal code is: {:?}", payload.referral_code);
trace!("Referal code is: {:?}", payload.referral_code);
if let Some(referral_code) = payload.referral_code.as_ref() {
// If it is not inside, also check in the database
trace!("Using register referral code: {:?}", referral_code);
@ -453,7 +453,7 @@ pub async fn user_logout_post(
.exec(&db_conn)
.await
{
debug!("Failed to delete {}: {}", user_bearer.redis_key(), err);
warn!("Failed to delete {}: {}", user_bearer.redis_key(), err);
}
let now = Utc::now();
@ -464,7 +464,7 @@ pub async fn user_logout_post(
.exec(&db_conn)
.await;
debug!("Deleted expired logins: {:?}", delete_result);
trace!("Deleted expired logins: {:?}", delete_result);
// also delete any expired pending logins
let delete_result = login::Entity::delete_many()
@ -472,7 +472,7 @@ pub async fn user_logout_post(
.exec(&db_conn)
.await;
debug!("Deleted expired pending logins: {:?}", delete_result);
trace!("Deleted expired pending logins: {:?}", delete_result);
// TODO: what should the response be? probably json something
Ok("goodbye".into_response())

@ -264,9 +264,11 @@ pub async fn user_balance_post(
// Setting the scale already does the decimal shift, no need to divide a second time
payment_token_amount.set_scale(payment_token_decimals)?;
debug!(
"Found deposit event for: {:?} {:?} {:?}",
recipient_account, payment_token_address, payment_token_amount
trace!(
"found deposit event for: {:?} {:?} {:?}",
recipient_account,
payment_token_address,
payment_token_amount
);
let recipient = match user::Entity::find()
@ -313,7 +315,7 @@ pub async fn user_balance_post(
.exec(&txn)
.await?;
debug!("Saving log {} of txid {:?}", log_index, tx_hash);
trace!("Saving log {} of txid {:?}", log_index, tx_hash);
let receipt = increase_on_chain_balance_receipt::ActiveModel {
id: sea_orm::ActiveValue::NotSet,
amount: sea_orm::ActiveValue::Set(payment_token_amount),

@ -58,7 +58,7 @@ pub async fn get_user_id_from_params(
.await?;
// TODO: emit a stat? if this is high something weird might be happening
debug!("cleared expired logins: {:?}", delete_result);
trace!("cleared expired logins: {:?}", delete_result);
return Err(Web3ProxyError::AccessDenied);
}

@ -642,7 +642,7 @@ impl Web3Rpc {
}
if let Some(url) = self.ws_url.clone() {
debug!("starting websocket provider on {}", self);
trace!("starting websocket provider on {}", self);
let x = connect_ws(url, usize::MAX).await?;
@ -655,7 +655,7 @@ impl Web3Rpc {
return Ok(());
}
debug!("starting subscriptions on {}", self);
trace!("starting subscriptions on {}", self);
self.check_provider(chain_id).await?;
@ -790,7 +790,7 @@ impl Web3Rpc {
block_map: BlocksByHashCache,
subscribe_stop_rx: watch::Receiver<bool>,
) -> Web3ProxyResult<()> {
debug!("subscribing to new heads on {}", self);
trace!("subscribing to new heads on {}", self);
// TODO: different handler depending on backup or not
let error_handler = None;

@ -427,7 +427,7 @@ pub async fn query_user_stats<'a>(
out.insert("rpc_key", serde_json::Value::String(x.to_string()));
}
None => {
debug!("rpc_secret_key_id is not included in this query")
trace!("rpc_secret_key_id is not included in this query")
}
}
}

@ -385,17 +385,17 @@ impl BufferedRpcQueryStats {
// referral_entity.credits_applied_for_referrer * (Decimal::from(10) checks (atomically using this table only), whether the user has brought in >$100 to the referer
// In this case, the sender receives $100 as a bonus / gift
// Apply a 10$ bonus onto the user, if the user has spent 100$
debug!(
trace!(
"Were credits applied so far? {:?} {:?}",
referral_entity.credits_applied_for_referee,
!referral_entity.credits_applied_for_referee
);
debug!(
trace!(
"Credits applied for referrer so far? {:?}",
referral_entity.credits_applied_for_referrer
);
debug!("Sum credits used? {:?}", self.sum_credits_used);
debug!(
trace!("Sum credits used? {:?}", self.sum_credits_used);
trace!(
"Hello: {:?}",
(referral_entity.credits_applied_for_referrer * (Decimal::from(10))
+ self.sum_credits_used)
@ -406,7 +406,7 @@ impl BufferedRpcQueryStats {
+ self.sum_credits_used)
>= Decimal::from(100)
{
debug!("Adding sender bonus balance");
trace!("Adding sender bonus balance");
deltas.usage_bonus_to_request_sender_through_referral = Decimal::from(10);
deltas.apply_usage_bonus_to_request_sender = true;
}
@ -476,9 +476,10 @@ impl BufferedRpcQueryStats {
};
// In any case, add to the balance
debug!(
trace!(
"Delta is: {:?} from credits used {:?}",
deltas, self.sum_credits_used
deltas,
self.sum_credits_used
);
let _ = balance::Entity::insert(user_balance)
.on_conflict(
@ -507,7 +508,7 @@ impl BufferedRpcQueryStats {
// Do the referrer_entry updates
if let Some((referral_entity, referrer_code_entity)) = referral_objects {
debug!("Positive referrer deposit delta");
trace!("Positive referrer deposit delta");
let referee_entry = referee::ActiveModel {
id: sea_orm::Unchanged(referral_entity.id),
credits_applied_for_referee: sea_orm::Set(