mirror of
https://github.com/flibusta-apps/telegram_files_server.git
synced 2025-12-06 20:45:37 +01:00
Fix
This commit is contained in:
@@ -32,7 +32,7 @@ pub struct MessageInfo {
|
||||
|
||||
pub static TEMP_FILES_CACHE: Lazy<Cache<i32, MessageId>> = Lazy::new(|| {
|
||||
Cache::builder()
|
||||
.time_to_idle(std::time::Duration::from_secs(16))
|
||||
.time_to_idle(std::time::Duration::from_secs(5 * 60 * 60))
|
||||
.max_capacity(4098)
|
||||
.async_eviction_listener(|_data_id, message_id, _cause| {
|
||||
Box::pin(async move {
|
||||
@@ -98,7 +98,7 @@ pub async fn download_file(chat_id: i64, message_id: i32) -> Option<BotDownloade
|
||||
return None;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
TEMP_FILES_CACHE.insert(message_id, forwarded_message.id.clone()).await;
|
||||
|
||||
let path = match bot.get_file(file_id.clone()).await {
|
||||
|
||||
@@ -93,7 +93,7 @@ async fn download(Path((chat_id, message_id)): Path<(i64, i32)>) -> impl IntoRes
|
||||
|
||||
let data = match downloader {
|
||||
Some(v) => v.get_async_read(),
|
||||
None => return StatusCode::NOT_FOUND.into_response()
|
||||
None => return StatusCode::BAD_REQUEST.into_response()
|
||||
};
|
||||
|
||||
let reader = ReaderStream::new(data);
|
||||
|
||||
Reference in New Issue
Block a user