fix: improve workflow as code row-lock on db to handle more concurrency

This commit is contained in:
Ruben Fiszel
2024-10-12 03:39:43 +02:00
parent 016292a374
commit 8232b4cdb0
+5 -3
View File
@@ -3062,9 +3062,9 @@ pub async fn run_workflow_as_code(
check_license_key_valid().await?;
check_tag_available_for_workspace(&w_id, &run_query.tag).await?;
let mut tx: QueueTransaction<'_, _> = (rsmq, user_db.begin(&authed).await?).into();
let job = get_queued_job(&job_id, &w_id, &db).await?;
let job = not_found_if_none(job, "Queued Job", &job_id.to_string())?;
let (job_payload, tag, _delete_after_use, timeout) = match job.job_kind {
JobKind::Preview => (
@@ -3089,7 +3089,7 @@ pub async fn run_workflow_as_code(
JobKind::Script => {
script_path_to_payload(
job.script_path(),
&mut tx,
&db,
&w_id,
run_query.skip_preprocessor,
)
@@ -3106,6 +3106,8 @@ pub async fn run_workflow_as_code(
let tag = run_query.tag.clone().or(tag).or(Some(job.tag));
let tx: QueueTransaction<'_, _> = (rsmq, user_db.begin(&authed).await?).into();
let tx = PushIsolationLevel::Transaction(tx);
let (uuid, mut tx) = push(