fix weird end-of-file bug by having downloaders use inotify to directly track changes

This commit is contained in:
xenofem 2022-04-29 22:36:44 -04:00
parent ba4c7bfcbe
commit cc0aaaab94
8 changed files with 246 additions and 283 deletions

View file

@ -1,6 +1,6 @@
use std::{collections::HashMap, io::ErrorKind};
use log::{error, info, warn, debug};
use log::{debug, error, info, warn};
use tokio::{
fs::File,
io::{AsyncReadExt, AsyncWriteExt},
@ -52,7 +52,7 @@ pub(crate) mod timestamp {
}
async fn is_valid_entry(key: &str, info: &DownloadableFile) -> bool {
if !crate::util::is_ascii_alphanumeric(&key) {
if !crate::util::is_ascii_alphanumeric(key) {
error!("Invalid key in persistent storage: {}", key);
return false;
}
@ -142,10 +142,4 @@ impl PersistentState {
self.0.remove(key);
self.save().await
}
pub(crate) fn remove_uploader(&mut self, key: &str) {
if let Some(f) = self.0.get_mut(key) {
f.uploader.take();
}
}
}