fix: rate limiting
fix: wait longer for invoice
This commit is contained in:
parent
797231946a
commit
aca1a8236c
4 changed files with 21 additions and 5 deletions
|
@ -157,6 +157,14 @@ macro_rules! check_user_blocked_or_private {
|
||||||
.await
|
.await
|
||||||
.is_ok(),
|
.is_ok(),
|
||||||
);
|
);
|
||||||
|
context.insert(
|
||||||
|
"is_following",
|
||||||
|
&$data
|
||||||
|
.0
|
||||||
|
.get_userfollow_by_initiator_receiver(ua.id, $other_user.id)
|
||||||
|
.await
|
||||||
|
.is_ok(),
|
||||||
|
);
|
||||||
|
|
||||||
return Ok(Html(
|
return Ok(Html(
|
||||||
$data.1.render("profile/private.html", &context).unwrap(),
|
$data.1.render("profile/private.html", &context).unwrap(),
|
||||||
|
|
|
@ -59,8 +59,8 @@ async fn main() {
|
||||||
// governor
|
// governor
|
||||||
let governor_config = Arc::new(
|
let governor_config = Arc::new(
|
||||||
GovernorConfigBuilder::default()
|
GovernorConfigBuilder::default()
|
||||||
.per_millisecond(75)
|
.per_millisecond(64)
|
||||||
.burst_size(32)
|
.burst_size(128)
|
||||||
.finish()
|
.finish()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
);
|
);
|
||||||
|
|
|
@ -1112,7 +1112,7 @@ show_kick=false, secondary=false) -%}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="flex justify-center flex-col"
|
class="flex justify-center flex-col"
|
||||||
style="{% if show_menu or show_kick %}width: 60%{% endif %}"
|
style="{% if show_menu or show_kick %}width: 60%{% else %}max-width: 200px{% endif %}"
|
||||||
>
|
>
|
||||||
{{ self::full_username(user=user) }}
|
{{ self::full_username(user=user) }}
|
||||||
<div class="user_status">{{ self::user_status(other_user=user) }}</div>
|
<div class="user_status">{{ self::user_status(other_user=user) }}</div>
|
||||||
|
|
|
@ -70,8 +70,8 @@ pub async fn stripe_webhook(
|
||||||
|
|
||||||
let customer_id = invoice.customer.unwrap().id();
|
let customer_id = invoice.customer.unwrap().id();
|
||||||
|
|
||||||
// allow 10s for everything to finalize
|
// allow 30s for everything to finalize
|
||||||
tokio::time::sleep(Duration::from_secs(10)).await;
|
tokio::time::sleep(Duration::from_secs(30)).await;
|
||||||
|
|
||||||
// pull user and update role
|
// pull user and update role
|
||||||
let user = match data.get_user_by_stripe_id(customer_id.as_str()).await {
|
let user = match data.get_user_by_stripe_id(customer_id.as_str()).await {
|
||||||
|
@ -79,6 +79,14 @@ pub async fn stripe_webhook(
|
||||||
Err(e) => return Json(e.into()),
|
Err(e) => return Json(e.into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if user.permissions.check(FinePermission::SUPPORTER) {
|
||||||
|
return Json(ApiReturn {
|
||||||
|
ok: true,
|
||||||
|
message: "Already applied".to_string(),
|
||||||
|
payload: (),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
tracing::info!("invoice {} (stripe: {})", user.id, customer_id);
|
tracing::info!("invoice {} (stripe: {})", user.id, customer_id);
|
||||||
let new_user_permissions = user.permissions | FinePermission::SUPPORTER;
|
let new_user_permissions = user.permissions | FinePermission::SUPPORTER;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue