1
0

Add logging and change limit of Mural payouts task (#4798)

This commit is contained in:
aecsocket
2025-11-19 12:38:30 +00:00
committed by GitHub
parent 9af19d01e5
commit 2f0ef07944
3 changed files with 22 additions and 5 deletions

View File

@@ -197,7 +197,8 @@ pub async fn payouts(
}
pub async fn sync_payout_statuses(pool: sqlx::Pool<Postgres>, mural: MuralPay) {
const LIMIT: u32 = 1000;
// Mural sets a max limit of 100 for search payouts endpoint
const LIMIT: u32 = 100;
info!("Started syncing payout statuses");

View File

@@ -9,7 +9,7 @@ use queue::{
session::AuthQueue, socket::ActiveSockets,
};
use sqlx::Postgres;
use tracing::{info, warn};
use tracing::{debug, info, warn};
extern crate clickhouse as clickhouse_crate;
use clickhouse_crate::Client;
@@ -240,14 +240,14 @@ pub fn app_setup(
let redis_ref = redis_ref.clone();
async move {
info!("Indexing analytics queue");
debug!("Indexing analytics queue");
let result = analytics_queue_ref
.index(client_ref, &redis_ref, &pool_ref)
.await;
if let Err(e) = result {
warn!("Indexing analytics queue failed: {:?}", e);
}
info!("Done indexing analytics queue");
debug!("Done indexing analytics queue");
}
});
}

View File

@@ -6,7 +6,7 @@ use muralpay::{MuralError, MuralPay, TokenFeeRequest};
use rust_decimal::{Decimal, prelude::ToPrimitive};
use serde::{Deserialize, Serialize};
use sqlx::PgPool;
use tracing::warn;
use tracing::{info, warn};
use crate::{
database::models::DBPayoutId,
@@ -271,6 +271,8 @@ pub async fn sync_pending_payouts_from_mural(
status: PayoutStatus,
}
info!("Syncing pending payouts from Mural");
let mut txn = db
.begin()
.await
@@ -299,6 +301,8 @@ pub async fn sync_pending_payouts_from_mural(
.await
.wrap_internal_err("failed to fetch incomplete Mural payouts")?;
info!("Found {} incomplete Mural payouts", rows.len());
let futs = rows.into_iter().map(|row| async move {
let platform_id = row.platform_id.wrap_err("no platform ID")?;
let payout_request_id = platform_id.parse::<muralpay::PayoutRequestId>()
@@ -369,6 +373,8 @@ pub async fn sync_failed_mural_payouts_to_labrinth(
mural: &MuralPay,
limit: u32,
) -> eyre::Result<()> {
info!("Syncing failed Mural payouts to Labrinth");
let mut next_id = None;
loop {
let search_resp = mural
@@ -393,6 +399,11 @@ pub async fn sync_failed_mural_payouts_to_labrinth(
break;
}
info!(
"Found {} canceled or failed Mural payouts",
search_resp.results.len()
);
let mut payout_platform_id = Vec::<String>::new();
let mut payout_new_status = Vec::<String>::new();
@@ -430,6 +441,11 @@ pub async fn sync_failed_mural_payouts_to_labrinth(
.await
.wrap_internal_err("failed to update payout statuses")?;
info!(
"Updated {} payouts in database from Mural info",
payout_platform_id.len()
);
if next_id.is_none() {
break;
}