Upgraded several Rust dependencies to new major versions (#1238)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-26 19:23:43 +01:00
1 parent 902e406e1d
commit d19d3d431b
8 files changed
+126 -68

No files matched your search

+5 -2
View File
@@ -338,10 +338,13 @@ fn get_log_time(now: &mut DeferredNow, record: &log::Record) -> LogTime {
},
// Case: The event happened earlier, e.g., in the .NET server. The logger
// runs in UTC (see init_logging), so this time is written in UTC as well:
// runs in UTC (see init_logging), so this time is written in UTC as well.
// flexi_logger keeps the arrival time as a jiff value, whose microseconds
// since the Unix epoch carry it over to chrono:
Some(created_at) => LogTime {
timestamp: created_at.format(flexi_logger::TS_DASHES_BLANK_COLONS_DOT_BLANK).to_string(),
delay_ms: get_notable_delay_ms(created_at, now.now_utc_owned()),
delay_ms: DateTime::<Utc>::from_timestamp_micros(now.now().timestamp().as_microsecond())
.and_then(|arrived_at| get_notable_delay_ms(created_at, arrived_at)),
},
}
}
+25
View File
@@ -1738,6 +1738,31 @@ mod tests {
assert_eq!(clusters, 2);
}
/// Verifies that every block keeps a known size. A block of exactly 127 bytes, i.e., an Opus
/// packet of 123 bytes plus the 4 bytes of the block header, must not get the size 0xFF, which
/// EBML reserves for an element of unknown size.
#[test]
fn webm_writer_keeps_the_size_of_every_block_known() {
let path = std::env::temp_dir().join(format!("ai-studio-media-block-size-{}.webm", rand::random::<u64>()));
let mut writer = WebmOpusWriter::new(File::create(&path).unwrap()).unwrap();
for (index, packet_len) in [122, 123, 124].into_iter().enumerate() {
writer.write_packet(&vec![0xf8; packet_len], index as u64 * 960).unwrap();
}
writer.finish().unwrap();
let bytes = fs::read(&path).unwrap();
let _ = fs::remove_file(path);
let tags = WebmIterator::new(Cursor::new(bytes), &[]).collect::<Result<Vec<_>, _>>().unwrap();
let block_lengths: Vec<_> = tags.iter()
.filter_map(|tag| match tag {
MatroskaSpec::SimpleBlock(block) => Some(block.len()),
_ => None,
})
.collect();
assert_eq!(block_lengths, vec![126, 127, 128]);
}
/// Verifies deterministic arithmetic-mean downmixing.
#[test]
fn downmix_is_bounded_and_balanced() {
+5 -2
View File
@@ -805,7 +805,7 @@ fn ensure_enough_space(required_bytes: u64, available_bytes: Option<u64>) -> Qdr
/// path as it is serves as the fallback.
fn available_space(path: &Path) -> Option<u64> {
let disks = sysinfo::Disks::new_with_refreshed_list()
.list()
.ok()?
.iter()
.map(|disk| DiskSpace {
mount_point: disk.mount_point().to_path_buf(),
@@ -2018,10 +2018,13 @@ mod tests {
database.search_embedding(SEARCH_STORE, search_vector(), 3, None, &[]).unwrap();
assert_eq!(payload_indexes(&database).len(), INDEXED_PAYLOAD_FIELDS.len());
// On Windows, an open WAL locks the file `.wal` in its directory against every other handle,
// so the WAL can be read only after the store is closed, just like before it was loaded:
drop(database);
// Not assert_eq: on failure, it would print every byte of the WAL.
assert!(file_contents(&wal_path) == wal, "loading the store left its WAL as it was");
drop(database);
fs::remove_dir_all(test_directory).unwrap();
}
+36 -2
View File
@@ -32,7 +32,8 @@ pub fn kill_stale_process(pid_file_path: PathBuf, sidecar_type: SidecarType) ->
let pid_file_content = fs::read_to_string(&pid_file_path)?;
let (pid, expected_name) = parse_pid_file(&pid_file_content)?;
let mut system = System::new_all();
// Refreshing the one process adds it, so the system needs to load nothing else:
let mut system = System::new().map_err(Error::other)?;
let pid = Pid::from_u32(pid);
system.refresh_processes(ProcessesToUpdate::Some(&[pid]), true);
@@ -63,7 +64,17 @@ pub fn kill_stale_process(pid_file_path: PathBuf, sidecar_type: SidecarType) ->
}
pub fn log_potential_stale_process(pid_file_path: PathBuf, pid: u32, sidecar_type: SidecarType) {
let mut system = System::new_all();
let mut system = match System::new() {
Ok(system) => system,
Err(e) => {
warn!(Source="Stale Process Cleanup";
"{}: Pid file with process number '{}' was not created because the processes could not be read: {}",
sidecar_type, pid, e
);
return;
}
};
let pid = Pid::from_u32(pid);
system.refresh_processes(ProcessesToUpdate::Some(&[pid]), true);
let Some(process) = system.process(pid) else {
@@ -87,3 +98,26 @@ pub fn log_potential_stale_process(pid_file_path: PathBuf, pid: u32, sidecar_typ
}
}
}
// The test starts `sleep`, which Windows lacks:
#[cfg(all(test, unix))]
mod tests {
use super::*;
/// Verifies that a process found by its number alone gets a PID file and is killed later on.
#[test]
fn stale_process_is_recorded_and_killed() {
use std::os::unix::process::ExitStatusExt;
let mut child = std::process::Command::new("sleep").arg("30").spawn().unwrap();
let pid_file_path = std::env::temp_dir().join(format!("ai-studio-stale-process-{}.pid", rand::random::<u64>()));
log_potential_stale_process(pid_file_path.clone(), child.id(), SidecarType::Dotnet);
let content = fs::read_to_string(&pid_file_path).unwrap();
assert_eq!(content, format!("{}\nsleep\n", child.id()));
kill_stale_process(pid_file_path.clone(), SidecarType::Dotnet).unwrap();
assert!(!pid_file_path.exists());
assert_eq!(child.wait().unwrap().signal(), Some(9));
}
}