mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-25 00:01:55 +00:00
fix: make dedicated workers work with dates in bun
This commit is contained in:
@@ -1017,12 +1017,12 @@ pub async fn start_worker(
|
||||
.enumerate()
|
||||
.filter_map(|(i, x)| {
|
||||
if matches!(x.typ, Typ::Datetime) {
|
||||
Some(i)
|
||||
Some(x.name.clone())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.map(|x| return format!("args[{x}] = args[{x}] ? new Date(args[{x}]) : undefined"))
|
||||
.map(|x| return format!("{x} = {x} ? new Date({x}) : undefined"))
|
||||
.join("\n");
|
||||
|
||||
let spread = args.into_iter().map(|x| x.name).join(",");
|
||||
@@ -1050,7 +1050,6 @@ BigInt.prototype.toJSON = function () {{
|
||||
return this.toString();
|
||||
}};
|
||||
|
||||
{dates}
|
||||
|
||||
console.log('start');
|
||||
|
||||
@@ -1062,6 +1061,7 @@ for await (const line of Readline.createInterface({{ input: process.stdin }})) {
|
||||
}}
|
||||
try {{
|
||||
let {{ {spread} }} = JSON.parse(line)
|
||||
{dates}
|
||||
let res = await Main.main(...[ {spread} ]);
|
||||
console.log("wm_res[success]:" + JSON.stringify(res ?? null, (key, value) => typeof value === 'undefined' ? null : value));
|
||||
}} catch (e) {{
|
||||
|
||||
@@ -156,7 +156,7 @@ pub async fn handle_dedicated_process(
|
||||
logs.push_str(&line);
|
||||
logs.push_str("\n");
|
||||
} else {
|
||||
tracing::info!("dedicated worker process exited");
|
||||
tracing::info!("dedicated worker process exited {script_path}");
|
||||
break;
|
||||
}
|
||||
},
|
||||
@@ -165,7 +165,7 @@ pub async fn handle_dedicated_process(
|
||||
|
||||
if let Some(line) = line.expect("line is ok") {
|
||||
if line == "start" {
|
||||
tracing::info!("dedicated worker process started");
|
||||
tracing::info!("dedicated worker process started {script_path}");
|
||||
continue;
|
||||
}
|
||||
tracing::debug!("processed job: |{line}|");
|
||||
@@ -219,8 +219,8 @@ pub async fn handle_dedicated_process(
|
||||
|
||||
child
|
||||
.await
|
||||
.map_err(|e| anyhow::anyhow!("child process encountered an error: {e:#}"))?;
|
||||
tracing::info!("dedicated worker child process exited successfully");
|
||||
.map_err(|e| anyhow::anyhow!("child process {script_path} encountered an error: {e:#}"))?;
|
||||
tracing::info!("dedicated worker {script_path} child process exited successfully");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user