Skip to content

Commit 74cf3f0

Browse files
authored
Automatically fail payments that are older than 30 days (#3697)
1 parent 84adf79 commit 74cf3f0

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

apps/labrinth/.sqlx/query-33893ae0a7d244c33b489e4d4fa444fa17a6bb5b7a834794a5482f4dc85c6ce0.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/labrinth/src/queue/payouts.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,18 @@ pub async fn process_payout(
735735
pool: &PgPool,
736736
client: &clickhouse::Client,
737737
) -> Result<(), ApiError> {
738+
sqlx::query!(
739+
"
740+
UPDATE payouts
741+
SET status = $1
742+
WHERE status = $2 AND created < NOW() - INTERVAL '30 days'
743+
",
744+
crate::models::payouts::PayoutStatus::Failed.as_str(),
745+
crate::models::payouts::PayoutStatus::InTransit.as_str(),
746+
)
747+
.execute(pool)
748+
.await?;
749+
738750
let start: DateTime<Utc> = DateTime::from_naive_utc_and_offset(
739751
(Utc::now() - Duration::days(1))
740752
.date_naive()

0 commit comments

Comments
 (0)