mirror of
https://github.com/modrinth/code.git
synced 2026-08-30 19:46:33 +00:00
allow skipping 2min timer
This commit is contained in:
+5
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n SELECT\n NOW() AS \"started_at!\",\n NOW() + INTERVAL '2 minutes' AS \"execute_at!\"\n ",
|
||||
"query": "\n SELECT\n NOW() AS \"started_at!\",\n CASE\n WHEN $1 THEN NOW()\n ELSE NOW() + INTERVAL '2 minutes'\n END AS \"execute_at!\"\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
@@ -15,12 +15,14 @@
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": []
|
||||
"Left": [
|
||||
"Bool"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
null,
|
||||
null
|
||||
]
|
||||
},
|
||||
"hash": "b22226128dbe12c7c4144928409480eb891bd6b793bf3b21691746f8eb5de113"
|
||||
"hash": "fcec6572c9543748dd515308fa4ad892348f29ab2ffe5ed4100a3aab8f22eb98"
|
||||
}
|
||||
@@ -43,6 +43,12 @@ pub struct StartPayoutRun {
|
||||
#[cfg(debug_assertions)]
|
||||
#[serde(default)]
|
||||
pub ignore_totp: bool,
|
||||
/// Schedule the payout run for immediate execution when testing locally.
|
||||
///
|
||||
/// This field does not exist in release builds.
|
||||
#[cfg(debug_assertions)]
|
||||
#[serde(default)]
|
||||
pub execute_now: bool,
|
||||
#[serde(with = "rust_decimal::serde::float")]
|
||||
pub raw_actual_revenue_usd: Decimal,
|
||||
pub revenue_adjustments: Vec<RevenueAdjustment>,
|
||||
@@ -233,6 +239,10 @@ pub async fn start_run(
|
||||
let ignore_totp = body.ignore_totp;
|
||||
#[cfg(not(debug_assertions))]
|
||||
let ignore_totp = false;
|
||||
#[cfg(debug_assertions)]
|
||||
let execute_now = body.execute_now;
|
||||
#[cfg(not(debug_assertions))]
|
||||
let execute_now = false;
|
||||
|
||||
if !ignore_totp {
|
||||
let two_factor_code = body
|
||||
@@ -390,8 +400,12 @@ pub async fn start_run(
|
||||
r#"
|
||||
SELECT
|
||||
NOW() AS "started_at!",
|
||||
NOW() + INTERVAL '2 minutes' AS "execute_at!"
|
||||
CASE
|
||||
WHEN $1 THEN NOW()
|
||||
ELSE NOW() + INTERVAL '2 minutes'
|
||||
END AS "execute_at!"
|
||||
"#,
|
||||
execute_now,
|
||||
)
|
||||
.fetch_one(&mut transaction)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user