use saturating_add and vec with_capacity in even more places
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
4ea7af5780
commit
83220b43a2
6 changed files with 20 additions and 20 deletions
|
@ -182,7 +182,7 @@ impl Service {
|
|||
|
||||
/// Deletes all remote only media files in the given at or after
|
||||
/// time/duration. Returns a u32 with the amount of media files deleted.
|
||||
pub async fn delete_all_remote_media_at_after_time(&self, time: String) -> Result<u32> {
|
||||
pub async fn delete_all_remote_media_at_after_time(&self, time: String) -> Result<usize> {
|
||||
let all_keys = self.db.get_all_media_keys();
|
||||
|
||||
let user_duration: SystemTime = match cyborgtime::parse_duration(&time) {
|
||||
|
@ -278,12 +278,12 @@ impl Service {
|
|||
|
||||
debug!("Deleting media now in the past \"{:?}\".", user_duration);
|
||||
|
||||
let mut deletion_count = 0;
|
||||
let mut deletion_count: usize = 0;
|
||||
|
||||
for mxc in remote_mxcs {
|
||||
debug!("Deleting MXC {mxc} from database and filesystem");
|
||||
self.delete(mxc).await?;
|
||||
deletion_count += 1;
|
||||
deletion_count = deletion_count.saturating_add(1);
|
||||
}
|
||||
|
||||
Ok(deletion_count)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue