From 33e6a18e63c6ff753f5fa08ecd17e933454fc486 Mon Sep 17 00:00:00 2001 From: Scott Lamb Date: Sun, 15 Oct 2023 15:21:29 -0700 Subject: [PATCH] fix benches broken with 02824353 --- server/src/mp4.rs | 2 +- server/src/web/mod.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/mp4.rs b/server/src/mp4.rs index fcb71b1a..f421ad40 100644 --- a/server/src/mp4.rs +++ b/server/src/mp4.rs @@ -3070,7 +3070,7 @@ mod bench { #[bench] fn serve_generated_bytes(b: &mut test::Bencher) { testutil::init(); - let server = server.get_or_init(BenchServer::new); + let server = SERVER.get_or_init(BenchServer::new); let p = server.generated_len; b.bytes = p; let client = reqwest::Client::new(); diff --git a/server/src/web/mod.rs b/server/src/web/mod.rs index 713912d0..444618a3 100644 --- a/server/src/web/mod.rs +++ b/server/src/web/mod.rs @@ -783,7 +783,7 @@ mod bench { use db::testutil::{self, TestDb}; use hyper; - use std::sync::Arc; + use std::sync::{Arc, OnceLock}; use uuid::Uuid; struct Server { @@ -840,12 +840,12 @@ mod bench { } } - static SERVER: once_cell::sync::Lazy = once_cell::sync::Lazy::new(Server::new); + static SERVER: OnceLock = OnceLock::new(); #[bench] fn serve_stream_recordings(b: &mut test::Bencher) { testutil::init(); - let server = &*SERVER; + let server = SERVER.get_or_init(Server::new); let url = reqwest::Url::parse(&format!( "{}/api/cameras/{}/main/recordings", server.base_url, server.test_camera_uuid