improved all provider
This commit is contained in:
@@ -8,7 +8,7 @@ use crate::util::requester;
|
||||
|
||||
// Global cache: Map<ErrorSignature, LastSentTimestamp>
|
||||
static ERROR_CACHE: Lazy<DashMap<String, u64>> = Lazy::new(DashMap::new);
|
||||
const COOLDOWN_SECONDS: u64 = 3600; // 1 Hour cooldown
|
||||
// const COOLDOWN_SECONDS: u64 = 3600; // 1 Hour cooldown
|
||||
|
||||
pub fn format_error_chain(err: &dyn Error) -> String {
|
||||
let mut chain_str = String::new();
|
||||
@@ -40,11 +40,11 @@ pub async fn send_discord_error_report(
|
||||
// Create a unique key based on error content and location
|
||||
let error_signature = format!("{}-{}-{}", error_msg, file, line);
|
||||
|
||||
if let Some(last_sent) = ERROR_CACHE.get(&error_signature) {
|
||||
if now - *last_sent < COOLDOWN_SECONDS {
|
||||
if let Some(_) = ERROR_CACHE.get(&error_signature) {
|
||||
// if now - *last_sent < COOLDOWN_SECONDS {
|
||||
// Error is still in cooldown, skip sending
|
||||
return;
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
// Update the cache with the current timestamp
|
||||
|
||||
Reference in New Issue
Block a user