Media is not removed from the database [only 24 hours after deletion]

When I delete a message containing an attachment from a chat (either for everyone or just for me) I expect the attachment to also be deleted from the database. However, I was doing some tests with both the Android and Desktop version and the user databases got quickly massive, although I deleted the messages from the chats.
It doesn’t make sense to still save the message attachments if they aren’t accessible to a regular user. It is not really hard to manually delete the messages from the Desktop version, but it is impossible to do so from the mobile app.

I think the attachments are deleted, just not directly, but in periodic (EDIT: once daily I think) “housekeeping” runs.

Yes. More specifically, it will periodically try to remove unused files, but not within the same 24 hour period.

    match ctx.get_config_i64(Config::LastHousekeeping).await {
        Ok(last_housekeeping_time) => {
            let next_housekeeping_time =
                last_housekeeping_time.saturating_add(constants::HOUSEKEEPING_PERIOD);
            if next_housekeeping_time <= time() {
                sql::housekeeping(ctx).await.log_err(ctx).ok();
/// Period between `sql::housekeeping()` runs.
pub(crate) const HOUSEKEEPING_PERIOD: i64 = 24 * 60 * 60;
    if let Err(err) = remove_unused_files(context).await {

Ohhh, okay! My bad, then, for being an impatient :sweat_smile:

Although it is not obvious for most people, I understand it’s not a big deal, and it makes more sense from a resource viewpoint.

Thanks!!

Duplicate of The attachment is not deleted from the local storage.