Bump tokio to 1.10 and add a test to confirm memory usage of rolling_total (#392)

This commit is contained in:
James Wilson
2021-08-31 19:18:46 +01:00
committed by GitHub
parent 699c19736f
commit ec5db0fbbf
5 changed files with 25 additions and 5 deletions
+2 -2
View File
@@ -1734,9 +1734,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
version = "1.8.2"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2602b8af3767c285202012822834005f596c811042315fa7e9f5b12b2a43207"
checksum = "92036be488bb6594459f2e03b60e42df6f937fe6ca5c5ffdcb539c6b84dc40f5"
dependencies = [
"autocfg",
"bytes",
+20
View File
@@ -197,6 +197,26 @@ mod test {
use super::*;
#[test]
fn deosnt_grow_beyond_window_size() {
let start_time = Instant::now();
let granularity = Duration::from_secs(1);
let mut rolling_total = RollingTotalBuilder::new()
.granularity(granularity)
.window_size_multiple(3) // There should be no more than 3 buckets ever,
.time_source(UserTimeSource(start_time))
.start();
for n in 0..1_000 {
rolling_total.push(n);
rolling_total
.time_source()
.increment_by(Duration::from_millis(300)); // multiple values per granularity.
}
assert_eq!(rolling_total.averages().len(), 3);
}
#[test]
fn times_grouped_by_granularity_spacing() {
let start_time = Instant::now();
+1 -1
View File
@@ -31,7 +31,7 @@ smallvec = "1.6.1"
soketto = "0.6.0"
structopt = "0.3.21"
thiserror = "1.0.25"
tokio = { version = "1.7.0", features = ["full"] }
tokio = { version = "1.10.1", features = ["full"] }
tokio-util = { version = "0.6", features = ["compat"] }
[dev-dependencies]
+1 -1
View File
@@ -23,5 +23,5 @@ simple_logger = "1.11.0"
soketto = "0.6.0"
structopt = "0.3.21"
thiserror = "1.0.25"
tokio = { version = "1.7.0", features = ["full"] }
tokio = { version = "1.10.1", features = ["full"] }
tokio-util = { version = "0.6", features = ["compat"] }
+1 -1
View File
@@ -14,7 +14,7 @@ log = "0.4.14"
serde_json = "1.0.64"
soketto = "0.6.0"
thiserror = "1.0.25"
tokio = { version = "1.7.1", features = ["full"] }
tokio = { version = "1.10.1", features = ["full"] }
tokio-util = { version = "0.6.7", features = ["full"] }
common = { path = "../common" }
time = { version = "0.3.0", features = ["formatting"] }