mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-06 02:00:46 +00:00
upgrade chrono with vendored limitation
This commit is contained in:
1 parent
e0e85fed5f
commit
fc122cb996
28 files changed
+48
-31
No files matched your search
Generated
+10
-5
@@ -468,6 +468,12 @@ dependencies = [
|
||||
"tokio 1.34.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "android-tzdata"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
|
||||
|
||||
[[package]]
|
||||
name = "android_system_properties"
|
||||
version = "0.1.5"
|
||||
@@ -1037,18 +1043,17 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.22"
|
||||
version = "0.4.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1"
|
||||
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"serde",
|
||||
"time 0.1.45",
|
||||
"wasm-bindgen",
|
||||
"winapi 0.3.9",
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -18,7 +18,7 @@ path = "src/lib.rs"
|
||||
# (none)
|
||||
|
||||
# External
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
|
||||
# Serialization
|
||||
serde = "1.0.125"
|
||||
|
||||
@@ -20,7 +20,7 @@ tokens = { path = "../../../_types/tokens" }
|
||||
|
||||
# External
|
||||
bytes = "1.3"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
log = "0.4.14"
|
||||
once_cell = "1.9.0"
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ name = "datetimes"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
once_cell = "1.18.0"
|
||||
my-workspace-hack = { version = "0.1", path = "../../../my-workspace-hack" }
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ reusable_types = { path = "../../../_types/reusable_types" }
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
base64 = "0.21.0"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
log = "0.4.14"
|
||||
once_cell = "1.18.0"
|
||||
regex = "1.5.4"
|
||||
|
||||
@@ -23,7 +23,7 @@ elasticsearch = "8.5.0-alpha.1"
|
||||
log = "0.4.14"
|
||||
|
||||
# Serialization
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
serde = { version = "1.0.152", features = ["derive"] }
|
||||
serde_json = "1.0.108"
|
||||
my-workspace-hack = { version = "0.1", path = "../../../my-workspace-hack" }
|
||||
|
||||
@@ -24,7 +24,7 @@ redis_common = { path = "../redis_common" }
|
||||
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
log = "0.4.14"
|
||||
r2d2_redis = "0.14.0"
|
||||
my-workspace-hack = { version = "0.1", path = "../../../my-workspace-hack" }
|
||||
@@ -25,7 +25,7 @@ tokens = { path = "../../_types/tokens" }
|
||||
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
dotenv = "0.15.0"
|
||||
log = "0.4.14"
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ errors = { path = "../../lib/errors" }
|
||||
tokens = { path = "../../_types/tokens" }
|
||||
|
||||
# External
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
dotenv = "0.15.0"
|
||||
log = "0.4.14"
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ user_input_common = { path = "../user_input_common" }
|
||||
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
log = "0.4.14"
|
||||
once_cell = "1.18.0"
|
||||
regex = "1.5.4"
|
||||
|
||||
@@ -19,7 +19,7 @@ errors = { path = "../../lib/errors" }
|
||||
|
||||
# External
|
||||
bytes = "1.3"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
log = "0.4.14"
|
||||
once_cell = "1.18.0"
|
||||
strum = { version = "0.25", features = ["derive"] } # Fancy enum iteration, etc.
|
||||
|
||||
@@ -32,7 +32,7 @@ web_scrapers = { path = "../../lib/web_scrapers" }
|
||||
|
||||
# External
|
||||
base64 = "0.21.0"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated
|
||||
dotenv = "0.15.0"
|
||||
log = "0.4.14"
|
||||
|
||||
@@ -26,7 +26,7 @@ tokens = { path = "../../../_types/tokens" }
|
||||
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
dotenv = "0.15.0"
|
||||
hostname = "0.3.1"
|
||||
log = "0.4.14"
|
||||
|
||||
@@ -35,7 +35,7 @@ subprocess_common = { path = "../../../lib/subprocess_common" }
|
||||
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
dotenv = "0.15.0"
|
||||
hostname = "0.3.1"
|
||||
log = "0.4.14"
|
||||
|
||||
@@ -46,7 +46,7 @@ tts_common = { path = "../../../lib/tts_common" }
|
||||
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated
|
||||
dotenv = "0.15.0"
|
||||
hostname = "0.3.1"
|
||||
|
||||
@@ -43,7 +43,7 @@ newrelic-telemetry = { path = "../../../vendor/newrelic-telemetry-sdk-rust" }
|
||||
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
dotenv = "0.15.0"
|
||||
hostname = "0.3.1"
|
||||
lfu = "0.2.5"
|
||||
|
||||
@@ -28,7 +28,7 @@ mysql_queries = { path = "../../../lib/mysql_queries" }
|
||||
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
dotenv = "0.15.0"
|
||||
hostname = "0.3.1"
|
||||
log = "0.4.14"
|
||||
|
||||
@@ -32,7 +32,7 @@ newrelic-telemetry = { path = "../../../vendor/newrelic-telemetry-sdk-rust" }
|
||||
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated
|
||||
dotenv = "0.15.0"
|
||||
hostname = "0.3.1"
|
||||
|
||||
@@ -28,7 +28,7 @@ mysql_queries = { path = "../../../lib/mysql_queries" }
|
||||
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
dotenv = "0.15.0"
|
||||
hostname = "0.3.1"
|
||||
log = "0.4.14"
|
||||
|
||||
@@ -26,7 +26,7 @@ mysql_queries = { path = "../../../lib/mysql_queries" }
|
||||
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
dotenv = "0.15.0"
|
||||
hostname = "0.3.1"
|
||||
log = "0.4.14"
|
||||
|
||||
@@ -28,7 +28,7 @@ twitch_common = { path = "../../../lib/api_clients/twitch_common" }
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
base64 = "0.21.0"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
dotenv = "0.15.0"
|
||||
hostname = "0.3.1"
|
||||
lazy_static = "1.4.0"
|
||||
|
||||
@@ -24,7 +24,7 @@ url_config = { path = "../../../lib/url_config" }
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
base64 = "0.21.0"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
dotenv = "0.15.0"
|
||||
log = "0.4.14"
|
||||
once_cell = "1.18.0"
|
||||
|
||||
@@ -34,7 +34,7 @@ user_input_common = { path = "../../../lib/user_input_common" }
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
base64 = "0.21.0"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
dotenv = "0.15.0"
|
||||
lazy_static = "1.4.0" # Regex caching (TODO: Use OnceCell instead)
|
||||
log = "0.4.14"
|
||||
|
||||
@@ -21,7 +21,7 @@ errors = { path = "../../../lib/errors" }
|
||||
reusable_types = { path = "../../../_types/reusable_types" }
|
||||
|
||||
# External
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
dotenv = "0.15.0"
|
||||
hostname = "0.3.1"
|
||||
#once_cell = "1.9.0"
|
||||
|
||||
@@ -58,7 +58,7 @@ users_component = { path = "../../plugins/users" }
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
base64 = "0.21.0"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
derive_more = "0.99.17"
|
||||
dotenv = "0.15.0"
|
||||
hex = "0.4.3"
|
||||
|
||||
@@ -67,6 +67,7 @@ impl RedisRateLimiter {
|
||||
Err(err) => match err {
|
||||
Error::Client(_) => Ok(()), // NB: Fail open for failure to connect to Redis
|
||||
Error::Time(_) => Ok(()), // NB: Fail open for key parsing
|
||||
Error::ChronoTime(_) => Ok(()), // NB: Fail open for key parsing
|
||||
Error::LimitExceeded(_) => Err(RateLimiterError::RateLimitExceededError),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ twitch_common = { path = "../../../lib/api_clients/twitch_common" }
|
||||
# External
|
||||
anyhow = "1.0.75"
|
||||
base64 = "0.21.0"
|
||||
chrono = { version = "=0.4.22", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
derive_more = "0.99.17"
|
||||
dotenv = "0.15.0"
|
||||
hostname = "0.3.1"
|
||||
|
||||
Vendored
+12
-1
@@ -133,6 +133,7 @@ use std::error;
|
||||
use std::fmt;
|
||||
use std::ops::Add;
|
||||
use std::time::Duration;
|
||||
use time;
|
||||
|
||||
/// The default limit of requests in a period
|
||||
const DEFAULT_LIMIT: usize = 5000;
|
||||
@@ -321,6 +322,8 @@ pub enum Error {
|
||||
LimitExceeded(Status),
|
||||
/// A time conversion failed.
|
||||
Time(time::OutOfRangeError),
|
||||
/// A time conversion failed (Chrono).
|
||||
ChronoTime(chrono::OutOfRangeError),
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
@@ -329,6 +332,7 @@ impl fmt::Display for Error {
|
||||
Error::Client(ref err) => write!(f, "client error ({})", err),
|
||||
Error::LimitExceeded(ref status) => write!(f, "rate limit exceeded ({:?})", status),
|
||||
Error::Time(ref err) => write!(f, "time conversion error ({})", err),
|
||||
Error::ChronoTime(ref err) => write!(f, "time conversion error ({})", err),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -339,6 +343,7 @@ impl error::Error for Error {
|
||||
Error::Client(ref err) => err.source(),
|
||||
Error::LimitExceeded(_) => None,
|
||||
Error::Time(ref err) => err.source(),
|
||||
Error::ChronoTime(ref err) => err.source(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -355,6 +360,12 @@ impl From<time::OutOfRangeError> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<chrono::OutOfRangeError> for Error {
|
||||
fn from(err: chrono::OutOfRangeError) -> Self {
|
||||
Error::ChronoTime(err)
|
||||
}
|
||||
}
|
||||
|
||||
/// Builds a `Status`.
|
||||
fn build_status(count: usize, limit: usize, reset_epoch_utc: usize) -> Status {
|
||||
let remaining = if count >= limit { 0 } else { limit - count };
|
||||
@@ -367,7 +378,7 @@ fn build_status(count: usize, limit: usize, reset_epoch_utc: usize) -> Status {
|
||||
}
|
||||
|
||||
/// Calculates a timestamp for "now plus a duration".
|
||||
fn epoch_utc_plus(duration: Duration) -> Result<usize, time::OutOfRangeError> {
|
||||
fn epoch_utc_plus(duration: Duration) -> Result<usize, chrono::OutOfRangeError> {
|
||||
Ok(chrono::Utc::now()
|
||||
.add(chrono::Duration::from_std(duration)?)
|
||||
.round_subsecs(0)
|
||||
|
||||
Reference in new issue
Block a user