You've already forked AstralRinth
forked from didirus/AstralRinth
run migrate
This commit is contained in:
@@ -2271,11 +2271,9 @@ pub async fn index_billing(
|
||||
info!("Indexing billing queue");
|
||||
let res = async {
|
||||
// If a charge is open and due or has been attempted more than two days ago, it should be processed
|
||||
let mut transaction = pool.begin().await?;
|
||||
|
||||
let charges_to_do =
|
||||
crate::database::models::charge_item::ChargeItem::get_chargeable_lock(
|
||||
&mut transaction,
|
||||
crate::database::models::charge_item::ChargeItem::get_chargeable(
|
||||
&pool,
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -2396,8 +2394,14 @@ pub async fn index_billing(
|
||||
|
||||
charge.status = ChargeStatus::Processing;
|
||||
|
||||
if let Err(e) = stripe::PaymentIntent::create(&stripe_client, intent).await {
|
||||
tracing::error!("Failed to create payment intent: {:?}", e);
|
||||
if let Err(e) =
|
||||
stripe::PaymentIntent::create(&stripe_client, intent)
|
||||
.await
|
||||
{
|
||||
tracing::error!(
|
||||
"Failed to create payment intent: {:?}",
|
||||
e
|
||||
);
|
||||
charge.status = ChargeStatus::Failed;
|
||||
charge.last_attempt = Some(Utc::now());
|
||||
}
|
||||
@@ -2406,12 +2410,12 @@ pub async fn index_billing(
|
||||
charge.last_attempt = Some(Utc::now());
|
||||
}
|
||||
|
||||
let mut transaction = pool.begin().await?;
|
||||
charge.upsert(&mut transaction).await?;
|
||||
transaction.commit().await?;
|
||||
}
|
||||
}
|
||||
|
||||
transaction.commit().await?;
|
||||
|
||||
Ok::<(), ApiError>(())
|
||||
}
|
||||
.await;
|
||||
|
||||
Reference in New Issue
Block a user