mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 00:02:23 +00:00
c3ce89ec5f
* reorganize handle_child There were a couple issues with the current implementation: 1. When reading stdout and stderr from the child, as soon as we hit EOF on one we would stop reading from both (line 1420). This could lead to the return value not being read from the job program. 2. Lines read from stdout and stderr are put into a channel and read elsewhere with `rx.recv()` (line 1497) but that channel isn't read until empty. It is only read in the `while !done.load(...)` (line 1449) loop and that loop can stop after any `.store(true, ...)`. Which happens when the child exits, when the job is cancelled, when either stdout or stderr reach EOF... This can be verified by putting `dbg!(rx.recv().await)` or a similar assertion after the while loop before returning from that function. It shows the channel still containing log lines on rare occasions. I was pretty careful in this to maintain the current behaviour; adding comments to express intention. One difference in this is that some regular intervals (cancel check and ping update) should be more regular? Before... > at 00ms wait for 10ms > at 10ms do things for 3ms > at 13ms wait again for *10ms* > at 23ms do things again ... With change... > at 00ms wait for 10ms > at 10ms do things for 3ms > at 13ms wait again but for *7ms* > at 20ms do things again ... Which I'm guessing is preferable but I could be wrong. * renames; interpolate values in log messages * do `append_logs()` in tokio::task * tokio::time::interval & close pipe after limit * clean up comments