mirror of
https://github.com/modrinth/code.git
synced 2026-08-31 12:05:53 +00:00
remove running state
This commit is contained in:
@@ -51,7 +51,7 @@ impl DBPayoutPeriod {
|
||||
FROM payout_periods
|
||||
LEFT JOIN payout_runs active_run
|
||||
ON active_run.period = payout_periods.period
|
||||
AND active_run.status IN ('scheduled', 'running')
|
||||
AND active_run.status = 'scheduled'
|
||||
WHERE payout_periods.period = ANY($1)
|
||||
"#,
|
||||
periods,
|
||||
|
||||
@@ -21,7 +21,6 @@ use crate::queue::payout_run::PayoutRunPayload;
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum PayoutRunStatus {
|
||||
Scheduled,
|
||||
Running,
|
||||
Cancelled,
|
||||
Failed,
|
||||
Succeeded,
|
||||
|
||||
@@ -327,7 +327,7 @@ pub async fn start_run(
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
FROM payout_runs
|
||||
WHERE status IN ('scheduled', 'running')
|
||||
WHERE status = 'scheduled'
|
||||
) AS "has_active_run!",
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
@@ -343,7 +343,7 @@ pub async fn start_run(
|
||||
.wrap_internal_err("checking payout period run status")?;
|
||||
if run_state.has_active_run {
|
||||
return Err(ApiError::Conflict(eyre::eyre!(
|
||||
"another payout run is already scheduled or running",
|
||||
"another payout run is already scheduled",
|
||||
)));
|
||||
}
|
||||
if run_state.has_succeeded_run {
|
||||
@@ -419,7 +419,7 @@ pub async fn start_run(
|
||||
&& error.constraint() == Some("payout_runs_single_active")
|
||||
{
|
||||
return Err(ApiError::Conflict(eyre::eyre!(
|
||||
"another payout run is already scheduled or running",
|
||||
"another payout run is already scheduled",
|
||||
)));
|
||||
}
|
||||
create_run_result.wrap_internal_err("creating scheduled payout run")?;
|
||||
|
||||
Reference in New Issue
Block a user