New Creator Notifications (#4383)

* Some new notification types

* Fix error

* Use existing DB models rather than inline queries

* Fix template fillout

* Fix ModerationThreadMessageReceived

* Insert more notifications, fix some formatting

* chore: query cache, clippy, fmt

* chore: query cache, clippy, fmt

* Use outer transactions to insert notifications instead of creating a new one

* Join futures
This commit is contained in:
François-Xavier Talbot
2025-09-17 15:37:21 -04:00
committed by GitHub
parent 8149618187
commit 6da190ed01
25 changed files with 1211 additions and 77 deletions

View File

@@ -1,7 +1,8 @@
use crate::database::redis::RedisPool;
use crate::queue::email::EmailQueue;
use crate::queue::payouts::{
PayoutsQueue, insert_bank_balances_and_webhook, process_payout,
PayoutsQueue, index_payouts_notifications,
insert_bank_balances_and_webhook, process_payout,
};
use crate::search::indexing::index_projects;
use crate::{database, search};
@@ -38,7 +39,7 @@ impl BackgroundTask {
IndexSearch => index_search(pool, redis_pool, search_config).await,
ReleaseScheduled => release_scheduled(pool).await,
UpdateVersions => update_versions(pool, redis_pool).await,
Payouts => payouts(pool, clickhouse).await,
Payouts => payouts(pool, clickhouse, redis_pool).await,
IndexBilling => {
crate::routes::internal::billing::index_billing(
stripe_client,
@@ -147,12 +148,19 @@ pub async fn update_versions(
pub async fn payouts(
pool: sqlx::Pool<Postgres>,
clickhouse: clickhouse::Client,
redis_pool: RedisPool,
) {
info!("Started running payouts");
let result = process_payout(&pool, &clickhouse).await;
if let Err(e) = result {
warn!("Payouts run failed: {:?}", e);
}
let result = index_payouts_notifications(&pool, &redis_pool).await;
if let Err(e) = result {
warn!("Payouts notifications indexing failed: {:?}", e);
}
info!("Done running payouts");
}