Skip to content

Commit 6c37914

Browse files
committed
Fix travel states code
Signed-off-by: Asriel Camora <asriel@camora.dev>
1 parent 038ac32 commit 6c37914

1 file changed

Lines changed: 3 additions & 26 deletions

File tree

web/src/crons/refresh_travel_states.rs

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ use std::{
1515
process::{Output, Stdio},
1616
time::Duration,
1717
};
18-
use tokio::{
19-
io::{AsyncBufReadExt, AsyncReadExt, BufReader},
20-
process::Command,
21-
};
18+
use tokio::process::Command;
2219
use tokio_util::sync::CancellationToken;
2320

2421
pub struct RefreshTravelStates {
@@ -80,44 +77,24 @@ impl CronJob for RefreshTravelStates {
8077
format!("{:?}", cmd.as_std()).replace(self.config.password.as_str(), "***")
8178
);
8279

83-
log::info!("Spawning");
8480
let cmd = cmd.spawn()?;
85-
log::info!("Spawned");
86-
log::info!("Waiting");
87-
// let Output {
88-
// status,
89-
// stdout,
90-
// stderr,
91-
// } = cmd.wait_with_output().await?;
9281
let Output {
9382
status,
9483
stdout,
9584
stderr,
96-
} = await_cancellable!(cmd.wait_with_output(), stop_signal, {
97-
log::error!("Killing connector process...");
98-
// cmd.kill().await?;
99-
});
100-
log::info!("Waited");
85+
} = await_cancellable!(cmd.wait_with_output(), stop_signal);
10186
log::info!("Connector process exited with: {}", status);
102-
//drop(cmd);
10387

10488
let stdout = String::from_utf8_lossy(&stdout);
10589
let stderr = String::from_utf8_lossy(&stderr);
10690

10791
if !status.success() {
108-
bail!(
109-
"non-zero exit code: {}\nstdout:\n{}\nstderr:\n{}",
110-
status,
111-
stdout,
112-
stderr
113-
);
92+
bail!("non-zero exit code: {status}\nstdout:\n{stdout}\nstderr:\n{stderr}");
11493
}
11594

116-
log::info!("Getting travel parameters...");
11795
let travel_params = worlds::get_data();
11896
let mut travel_map: HashMap<u16, DCTravelWorldInfo> = HashMap::new();
11997
let mut travel_time: Option<i32> = None;
120-
log::info!("Parsing connector output...");
12198
for line in stdout.lines() {
12299
if let Some(line) = line.strip_prefix("[ERROR] ") {
123100
log::error!("{}", line);

0 commit comments

Comments
 (0)