mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-06 15:35:35 +01:00
Optimize
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -212,6 +212,7 @@ dependencies = [
|
|||||||
"sentry",
|
"sentry",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
"smallvec",
|
||||||
"strum",
|
"strum",
|
||||||
"strum_macros",
|
"strum_macros",
|
||||||
"teloxide",
|
"teloxide",
|
||||||
|
|||||||
@@ -28,3 +28,4 @@ sentry = "0.31.3"
|
|||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
moka = { version = "0.11.1", features = ["future"] }
|
moka = { version = "0.11.1", features = ["future"] }
|
||||||
axum = "0.6.18"
|
axum = "0.6.18"
|
||||||
|
smallvec = "1.10.0"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ use super::{ignore_channel_messages, BotCommands, BotHandler, bots_manager::get_
|
|||||||
async fn _update_activity(
|
async fn _update_activity(
|
||||||
me: teloxide::types::Me,
|
me: teloxide::types::Me,
|
||||||
user: teloxide::types::User,
|
user: teloxide::types::User,
|
||||||
activity_cache: Cache<UserId, bool>,
|
activity_cache: Cache<UserId, ()>,
|
||||||
user_langs_cache: Cache<UserId, Vec<String>>,
|
user_langs_cache: Cache<UserId, Vec<String>>,
|
||||||
) -> Option<()> {
|
) -> Option<()> {
|
||||||
if activity_cache.contains_key(&user.id) {
|
if activity_cache.contains_key(&user.id) {
|
||||||
@@ -50,7 +50,7 @@ async fn _update_activity(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if update_result.is_ok() {
|
if update_result.is_ok() {
|
||||||
activity_cache.insert(user.id, true).await;
|
activity_cache.insert(user.id, ()).await;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ use crate::config;
|
|||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct AppState {
|
pub struct AppState {
|
||||||
pub user_activity_cache: Cache<UserId, bool>,
|
pub user_activity_cache: Cache<UserId, ()>,
|
||||||
pub user_langs_cache: Cache<UserId, Vec<String>>,
|
pub user_langs_cache: Cache<UserId, Vec<String>>,
|
||||||
pub chat_donation_notifications_cache: Cache<ChatId, ()>,
|
pub chat_donation_notifications_cache: Cache<ChatId, ()>,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user