Skip to content
This repository has been archived by the owner on Nov 25, 2022. It is now read-only.

[wip] purge messages from server after N days #595

Closed
wants to merge 1 commit into from

Conversation

r10s
Copy link
Member

@r10s r10s commented Mar 2, 2019

todo:

  • introduce an option
  • purge messages from server after N days every N days
  • maybe also delete read-receipts
  • double-check the code
  • test

to make things as safe as possible, we'll only purge message from the DeltaChat folder or, if moving is disabled, from the INBOX by a positive list (the known messages in the database)

targets #164 and maybe #112

@adbenitez
Copy link
Member

adbenitez commented Mar 4, 2019 via email

@webratte
Copy link

webratte commented Mar 4, 2019

Hi @r10s
If you are want be sure not delete wrong messeges, you simply could move this mails into the trash folder instead delete it completely.

What do you think?

@adbenitez
Copy link
Member

adbenitez commented Mar 4, 2019 via email

@STPKITT
Copy link

STPKITT commented Mar 4, 2019

Is there even an IMAP command which really deletes messages circumventing the trash?

@adbenitez
Copy link
Member

adbenitez commented Mar 4, 2019

@STPKITT well you actually flag them as /Deleted and then issue expunge command, or something like that.
I think that servers like Gmail do really hard to actually delete a message, but all servers I had used respect the deleting of messages, I guess in servers where they just move them to trash are servers that offer lots of GB of space and probably auto-removing so maybe it is not a problem there.

@testbird
Copy link
Contributor

testbird commented Apr 11, 2019

Please implement this to be the server-limits and -cleanup part of the "auto-delete" background task from https://support.delta.chat/t/reduce-space-on-internal-storage-disk-full/132/24 (also keeping in mind its later extension to local-limits and -cleanup)

The -limits related details from #120 contain a nice storage space condition:

  • auto checks & deletes based on storage space limits (device & server)
    When the local filesystem, or the server space, is full, no more chat or email messages can be received.
    • On incoming messages, let DC check the available space on the server and on the device, and when the free space falls below say 6% or 110MB, notify the user that DC will soon (below 5% or 100MB) have to start automatically deleting the oldest chat messages on the server or on the device. Non-chat emails should not be deleted from the server.

@webratte
Copy link

webratte commented Apr 20, 2019

With "location streaming" comes a lot more mails which flooded the mailbox.

So delete older messages becomes more important.

@testbird
Copy link
Contributor

The problem of many meta-data messages mingled within regular messages won't get solved by a history limit.

Looks like #112 remains a different issue, that might best be solved with #644, using a "first see, first delete" approach that stores the updated state for the other clients using message flags or state messages.

@webratte
Copy link

@testbird
I don't agree.
A history limit would help to save server storage.

I could set it e.g. to 30 days. Time enough to sync my clients.

People with really less storage (e.g. @adbenitez) and no need for sync, could set it e.g. to 1 day or so.

So purge older messages would definitely help.

@adbenitez
Copy link
Member

adbenitez commented Apr 22, 2019 via email

@adbenitez
Copy link
Member

adbenitez commented Apr 22, 2019 via email

@testbird
Copy link
Contributor

testbird commented Apr 22, 2019

I don't agree.
A history limit would help to save server storage.

That's not the problem, and not what I wrote.
The problem is that a global history limit would not reduce or filter out the receipts etc. without also deleting the desired chat history.
But an separate syncing feature may fllter out the receipts etc. and reduce the server storage used by the chat history a lot.

@webratte
Copy link

webratte commented Apr 22, 2019 via email

@testbird
Copy link
Contributor

Yeah, #112 is a separate issue, that's what I meant (besides that actually quota based deletes will be needed to guarantee free space, especially with small servers).

#112 is not solved with this issue, contrary to the suggestion in the report (and #112 is actually better solved by deleting receipts with syncing feature #644 rather than only with the corresponding message).

@testbird
Copy link
Contributor

Wait a second, this issue is about server space, right?

Then why would one want to delete messages after N days, instead of limiting the number of messages?
Small servers may fill up quickly with a wave of messages. And low-traffic but high-interest chats can vanish too quickly, if a short temporal value is used trying to control a size value. (dimension mismatch)

Maybe have a look at this (updated) discussion post (again),
https://support.delta.chat/t/reduce-space-on-internal-storage-disk-full/132/24
this issue would corresponds to a first version of the "auto-delete-server".

@adbenitez
Copy link
Member

testbird, people want to delete based on time because in general the older a message is, the less important it is for an user, and the less they will remember it even exists

@testbird
Copy link
Contributor

testbird commented Apr 29, 2019

testbird, people want to delete based on time because in general the older a message is, the less important it is for an user, and the less they will remember it even exists

Remember this is a server issue.
We need to look at a more complete picture. I'll try to recap.

It's like this:
Peopple simply just see the chats.

And people also usually only want, and only need to deal with simple options to adjust the "history lengh" kept in chats. But this is NOT the "Max. number of messages kept on server", for which there should usually be no need for the user to change it.

The useful knobs for the user to shorten the list of messages in chats is rather "Limit number of (archived) messages (per chat)" or "Limit age of (archived) messages (per chat)", on the device. The latter would , however, also completely delete important but low traffic chats.

Note that it is actually not required to let user configure a history limit. (There are users with huge server and device strorage.) What's needed, however, is an auto-delete-server and auto-delete-client feature to avoid disk full errors, and avoid having to ship with a default history limit that would make all large server's storage space useless. History limits should still be easily configured though, if desired, as a personal preference:

If you review the options (I improved the sorting and wording.), I think the server setting "Max. number of messages kept on server, and thus synced across devices (per chat)" (topic of this issue) would be a really advanced "admin" setting, needed only for the mentioned special use-cases. And it makes sense for it to be an integer value, in order to make it easier for multiple watching clients to count and sync the n messages on the server, and detect those that expirie at the end of the list of messages on the server automatically. The user does not have to notice anything about this and only sees the total length of the chats.

@webratte
Copy link

webratte commented Apr 29, 2019 via email

@testbird
Copy link
Contributor

testbird commented Apr 29, 2019

If using a period of days for expiration on the server, a second client can not know the amount of days to keep a message from seeing just the list of chat messages on the server, and can't distinguish between a delete to sync (delete locally) and a delete to keep (archive locally). So, periodical expiration will not work well for multiple devices, on some syncing devices, nothing may be kept (i.e. enter the local archive) even if configured.

@webratte
Copy link

webratte commented Apr 29, 2019 via email

@testbird
Copy link
Contributor

testbird commented Apr 29, 2019

every e.g. monday

That will look strangely erratic to users, not help in a week with a lot of spam messages, not free up enogh space, ... and has problems if device is off one day.

Simplest: do the check on every client with every received message.

without to have to check which chat is involved

We're talking about the server here, and keeping a Trashbin is useless to free up space. Users will complain: I come back from vacation and deltachat deleted all my important messages (from the server, now not syncing anymore) just because friend/group X had sent me a lot (or large) messages.

@testbird
Copy link
Contributor

testbird commented Apr 29, 2019

Avoid sure problems when a better way is known.
Don't start in a direction if it is known to create more problems for the next steps than it solves "for now".

@testbird
Copy link
Contributor

testbird commented Apr 29, 2019

And again, considering the broader picture https://support.delta.chat/t/reduce-space-on-internal-storage-disk-full/132/24 this issue can be seen as a first implementation of "auto-delete-server".

@webratte
Copy link

webratte commented Apr 29, 2019

We're talking about the server here, and keeping a Trashbin is useless to free up space.

We talking about DC (the App) will check the server and delete the older messages.

Users will complain: I come back from vacation and deltachat deleted all my important messages just because friend/group X had sent me a lot (or large) messages.

Only if they was more then 6 month in hollydays (for my example)

@testbird
Copy link
Contributor

Only if theay was more then 6 month in hollydays (for my example)

See, particular examples are not working in general. Other users with few server space would have to reduce this purge setting a lot. And everything must still work. Half baked "features" can be detrimental.

@webratte
Copy link

See, particular examples are not working in general. Other users with few server space would have to reduce this purge setting a lot. And everything must still work. Half baked "features" can be detrimental.

Of course, mails should not deleted before it's downloaded.

@adbenitez
Copy link
Member

adbenitez commented Apr 29, 2019

I also think that instead of dreaming with a "perfect" method, we start with something simple that "works", we are in a situation with 100MB of server space, users run out of storage and they blame Delta Chat, because other email-chatting apps don't have this "error" so we need something that just delete the messages after they are downloaded to DC is data base, so even starting with a simple option like that (keep on server or remove them after download) will be enough for an start, of curse deleting based in time would be also something good to have, my point here testbird:
lets first have something that at least "works" and that can leverage the server storage situations for users and then we could work in more complex/fancy stuff.

@testbird
Copy link
Contributor

testbird commented Apr 29, 2019

I don't think anybody said to delete without at least the first client having downloaded the message. But the problem comes with devices that sync later, especially if coming back after a longer period.

start with something simple that "works",

Yes, sure. I am all for a very simple, first auto-delete-server, even if starting by only covering the "fallback", i.e. for the case of servers without quota support (limit to some default number of max. messages on the server).

My point is just that a time period based limit for server deletes does not work for multi-client sync. (It's a mistake to avoid.)

A total max. number of chat messages to keep on the server, however, should work. It is a not-user-facing technical server related setting that can also work for syncing later I think.

For limiting the chat history that the users keep and see on the device, a much more useful option for the user can be a simple separate, and user-visible "max. number of messages per chat" (relevant for the auto-delete-device).

@webratte
Copy link

webratte commented Apr 29, 2019 via email

@testbird
Copy link
Contributor

testbird commented Apr 29, 2019

OK.
The most simple, auto-delete-server solution does not even require to support detecting the free space (quota). It could just implement a FIFO of something like 250 messages by having a default fixed max. messages limit for the chat folder on the server, enforced by the clients. (Instead of fully featured deleting from different message categories while a free space condition is not met. #120)

It should work for a single device and multiple devices because:

  • Deletes require that one device is online anyway. (So no messages are completely missed when a very small limit (small server) requires deleting a still un-seen message, because at least one device already downloaded it before having to delete it.)
  • The corresponding cooperation rule for multiple devices is just, "If the oldest message gets deleted (or is seen to have disappeared), (assume) it was an expiration, so keep the local copy, instead of also deleting the message locally (not syncing with server as done for deletes of more recent messages)".

So this should work without requiring any separate sync and coordination data on the server, and no traffic overhead.

@webratte
Copy link

Should this issue reopened in rust-core?
I believe this is still a very important feature.

@r10s
Copy link
Member Author

r10s commented Sep 30, 2019

Should this issue reopened in rust-core?

this is not an issue, this is the unfinished try to fix an issue.

the belonging issue is still open and already moved to core-rust: deltachat/deltachat-core-rust#512

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants