Skip to content

Commit daa1d9d

Browse files
committed
repl
1 parent 4e584f9 commit daa1d9d

File tree

8 files changed

+512
-141
lines changed

8 files changed

+512
-141
lines changed

backend/windmill-common/src/worker.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -307,15 +307,16 @@ pub async fn store_suspended_pull_query(wc: &WorkerConfig) {
307307
}
308308

309309
pub fn make_pull_query(tags: &[String]) -> String {
310-
format_pull_query(format!(
310+
let query = format_pull_query(format!(
311311
"SELECT id
312312
FROM v2_job_queue
313313
WHERE running = false AND tag IN ({}) AND scheduled_for <= now()
314314
ORDER BY priority DESC NULLS LAST, scheduled_for
315315
FOR UPDATE SKIP LOCKED
316316
LIMIT 1",
317317
tags.iter().map(|x| format!("'{x}'")).join(", ")
318-
))
318+
));
319+
query
319320
}
320321

321322
pub async fn store_pull_query(wc: &WorkerConfig) {
@@ -382,10 +383,7 @@ fn normalize_path(path: &Path) -> PathBuf {
382383
ret
383384
}
384385

385-
pub fn is_allowed_file_location(
386-
job_dir: &str,
387-
user_defined_path: &str,
388-
) -> error::Result<PathBuf> {
386+
pub fn is_allowed_file_location(job_dir: &str, user_defined_path: &str) -> error::Result<PathBuf> {
389387
let job_dir = Path::new(job_dir);
390388
let user_path = PathBuf::from(user_defined_path);
391389

backend/windmill-queue/src/jobs.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -2155,13 +2155,13 @@ pub struct PulledJob {
21552155
pub permissioned_as_folders: Option<Vec<serde_json::Value>>,
21562156
}
21572157

2158-
#[derive(Serialize, Deserialize)]
2158+
#[derive(Debug, Serialize, Deserialize)]
21592159
pub enum PrecomputedAgentInfo {
21602160
Bun { local: String, remote: String },
21612161
Python { py_version: Option<u32>, requirements: Option<String> },
21622162
}
21632163

2164-
#[derive(Serialize, Deserialize)]
2164+
#[derive(Debug, Serialize, Deserialize)]
21652165
pub struct JobAndPerms {
21662166
pub job: MiniPulledJob,
21672167
pub raw_code: Option<String>,
@@ -2313,11 +2313,11 @@ pub async fn pull(
23132313
db: &Pool<Postgres>,
23142314
suspend_first: bool,
23152315
worker_name: &str,
2316-
query_o: Option<(String, String)>,
2316+
query_o: Option<&(String, String)>,
23172317
#[cfg(feature = "benchmark")] bench: &mut BenchmarkIter,
23182318
) -> windmill_common::error::Result<PulledJobResult> {
23192319
loop {
2320-
if let Some((query_suspended, query_no_suspend)) = query_o.as_ref() {
2320+
if let Some((query_suspended, query_no_suspend)) = query_o {
23212321
let njob = {
23222322
let job = sqlx::query_as::<_, PulledJob>(query_suspended)
23232323
.bind(worker_name)
@@ -2572,7 +2572,6 @@ async fn pull_single_job_and_mark_as_running_no_concurrency_limit<'c>(
25722572
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
25732573
return Ok((None, false));
25742574
}
2575-
25762575
let r = if suspend_first {
25772576
// tracing::info!("Pulling job with query: {}", query);
25782577
sqlx::query_as::<_, PulledJob>(&query)

0 commit comments

Comments
 (0)