mirror of
https://github.com/mailscope/kumomta.git
synced 2026-10-23 23:12:26 +00:00
remove problematic time 0.1 dependency
This commit is contained in:
Generated
+6
-17
@@ -3012,7 +3012,7 @@ checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b"
|
||||
dependencies = [
|
||||
"pem",
|
||||
"ring",
|
||||
"time 0.3.20",
|
||||
"time",
|
||||
"yasna",
|
||||
]
|
||||
|
||||
@@ -3036,10 +3036,10 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "redis-cell-impl"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/wez/redis-cell.git?rev=ec4c4510f01128d34ffa9733ff6fc5fbea116bf4#ec4c4510f01128d34ffa9733ff6fc5fbea116bf4"
|
||||
source = "git+https://github.com/wez/redis-cell.git?rev=97d409c3a62f2a0f5518c31fc9b4b65afbce2053#97d409c3a62f2a0f5518c31fc9b4b65afbce2053"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"time 0.1.43",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3694,7 +3694,6 @@ dependencies = [
|
||||
"redis-cell-impl",
|
||||
"serde",
|
||||
"thiserror",
|
||||
"time 0.1.43",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3717,16 +3716,6 @@ dependencies = [
|
||||
"tikv-jemalloc-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.1.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.20"
|
||||
@@ -3971,7 +3960,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"time 0.3.20",
|
||||
"time",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
@@ -4611,7 +4600,7 @@ version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd"
|
||||
dependencies = [
|
||||
"time 0.3.20",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4630,7 +4619,7 @@ dependencies = [
|
||||
"hmac",
|
||||
"pbkdf2",
|
||||
"sha1",
|
||||
"time 0.3.20",
|
||||
"time",
|
||||
"zstd 0.11.2+zstd.1.5.2",
|
||||
]
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ edition = "2021"
|
||||
anyhow = "1.0"
|
||||
mod-redis = {path="../mod-redis"}
|
||||
once_cell = "1.17"
|
||||
redis-cell-impl = { git = "https://github.com/wez/redis-cell.git", rev="ec4c4510f01128d34ffa9733ff6fc5fbea116bf4" }
|
||||
redis-cell-impl = { git = "https://github.com/wez/redis-cell.git", rev="97d409c3a62f2a0f5518c31fc9b4b65afbce2053" }
|
||||
serde = {version="1.0", features=["derive"]}
|
||||
time = "0.1" # for embedding redis-cell
|
||||
thiserror = "1.0"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//! among multiple machines.
|
||||
use mod_redis::{Cmd, FromRedisValue, RedisConnection, RedisError};
|
||||
use once_cell::sync::OnceCell;
|
||||
use redis_cell_impl::{MemoryStore, Rate, RateLimiter, RateQuota};
|
||||
use redis_cell_impl::{time, MemoryStore, Rate, RateLimiter, RateQuota};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::convert::TryFrom;
|
||||
use std::sync::Mutex;
|
||||
@@ -117,7 +117,7 @@ fn local_throttle(
|
||||
.unwrap();
|
||||
let max_rate = Rate::per_period(
|
||||
limit as i64,
|
||||
time::Duration::from_std(period).map_err(|err| Error::Generic(format!("{err:#}")))?,
|
||||
time::Duration::try_from(period).map_err(|err| Error::Generic(format!("{err:#}")))?,
|
||||
);
|
||||
let mut limiter = RateLimiter::new(
|
||||
&mut *store,
|
||||
@@ -134,12 +134,12 @@ fn local_throttle(
|
||||
// If either time had a partial component, bump it up to the next full
|
||||
// second because otherwise a fast-paced caller could try again too
|
||||
// early.
|
||||
let mut retry_after = rate_limit_result.retry_after.num_seconds();
|
||||
if rate_limit_result.retry_after.num_milliseconds() > 0 {
|
||||
let mut retry_after = rate_limit_result.retry_after.whole_seconds();
|
||||
if rate_limit_result.retry_after.subsec_milliseconds() > 0 {
|
||||
retry_after += 1
|
||||
}
|
||||
let mut reset_after = rate_limit_result.reset_after.num_seconds();
|
||||
if rate_limit_result.reset_after.num_milliseconds() > 0 {
|
||||
let mut reset_after = rate_limit_result.reset_after.whole_seconds();
|
||||
if rate_limit_result.reset_after.subsec_milliseconds() > 0 {
|
||||
reset_after += 1
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ mod test {
|
||||
"throttled after {throttled_iter} iterations for \
|
||||
limit {limit}. diff={diff}. tolerance {tolerance}"
|
||||
);
|
||||
let max_rate = Rate::per_period(limit as i64, time::Duration::from_std(period).unwrap());
|
||||
let max_rate = Rate::per_period(limit as i64, time::Duration::try_from(period).unwrap());
|
||||
println!("max_rate: {max_rate:?}");
|
||||
|
||||
assert!(
|
||||
|
||||
Reference in New Issue
Block a user