This commit is contained in:
Ruben Fiszel
2024-03-16 19:01:58 +01:00
parent 9745eec4d4
commit fd57b40064
2 changed files with 2 additions and 13 deletions
+2 -4
View File
@@ -1692,10 +1692,10 @@ pub async fn pull<R: rsmq_async::RsmqConnection + Send + Clone>(
tracing::info!("Job '{}' from path '{}' with concurrency key '{}' has reached its concurrency limit of {} jobs run in the last {} seconds. This job will be re-queued for next execution at {}",
job_uuid, job_script_path, job_custom_concurrent_limit, job_concurrency_key, job_custom_concurrency_time_window_s, estimated_next_schedule_timestamp);
let job_log_line_break = '\n';
let job_log_event = format!(
"Re-scheduled job to {estimated_next_schedule_timestamp} due to concurrency limits with key {job_concurrency_key} and limit {job_custom_concurrent_limit} in the last {job_custom_concurrency_time_window_s} seconds",
"\nRe-scheduled job to {estimated_next_schedule_timestamp} due to concurrency limits with key {job_concurrency_key} and limit {job_custom_concurrent_limit} in the last {job_custom_concurrency_time_window_s} seconds",
);
let _ = append_logs(job_uuid, pulled_job.workspace_id, job_log_event, db);
if rsmq.is_some() {
// if let Some(ref mut rsmq) = tx.rsmq {
// if using redis, only one message at a time can be poped from the queue. Process only this message and move to the next elligible job
@@ -1706,7 +1706,6 @@ pub async fn pull<R: rsmq_async::RsmqConnection + Send + Clone>(
SET running = false
, started_at = null
, scheduled_for = '{estimated_next_schedule_timestamp}'
, logs = CASE WHEN logs IS NULL OR logs = '' THEN '{job_log_event}'::text WHEN logs LIKE '%{job_log_event}' THEN logs ELSE concat(logs, '{job_log_line_break}{job_log_event}'::text) END
WHERE id = '{job_uuid}'
RETURNING tag"
))
@@ -1729,7 +1728,6 @@ pub async fn pull<R: rsmq_async::RsmqConnection + Send + Clone>(
SET running = false
, started_at = null
, scheduled_for = '{estimated_next_schedule_timestamp}'
, logs = CASE WHEN logs IS NULL OR logs = '' THEN '{job_log_event}'::text WHEN logs LIKE '%{job_log_event}' THEN logs ELSE concat(logs, '{job_log_line_break}{job_log_event}'::text) END
WHERE (id = '{job_uuid}') OR (script_path = '{job_script_path}' AND running = false AND scheduled_for <= now())"
))
.fetch_all(&mut tx)
-9
View File
@@ -2716,15 +2716,6 @@ async fn handle_queued_job<R: rsmq_async::RsmqConnection + Send + Sync + Clone>(
#[cfg(feature = "prometheus")]
timer.map(|x| x.stop_and_record());
} else {
if job.logs.as_ref().is_some_and(|x| !x.is_empty()) {
append_logs(
job.id,
job.workspace_id.clone(),
job.logs.clone().unwrap(),
db,
)
.await;
}
let mut logs = "".to_string();
let mut mem_peak: i32 = 0;
let mut canceled_by: Option<CanceledBy> = None;