Skip to content

api: add clear_all_relay_storage API#8105

Merged
link2xt merged 1 commit intomainfrom
link2xt/clear-all-relay-storage
Apr 19, 2026
Merged

api: add clear_all_relay_storage API#8105
link2xt merged 1 commit intomainfrom
link2xt/clear-all-relay-storage

Conversation

@link2xt
Copy link
Copy Markdown
Collaborator

@link2xt link2xt commented Apr 9, 2026

Closes #7730

I tested it with desktop: deltachat/deltachat-desktop#6207

@link2xt link2xt marked this pull request as ready for review April 9, 2026 03:23
@link2xt link2xt self-assigned this Apr 9, 2026
Comment thread src/scheduler.rs
@link2xt link2xt force-pushed the link2xt/clear-all-relay-storage branch from a5aa2bb to f640c65 Compare April 11, 2026 06:50

/// Requests to clear storage on all chatmail relays.
///
/// I/O must be started for this request to take effect.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// I/O must be started for this request to take effect.
/// I/O must be started for this request to take effect.
///
/// UIs should only offer this option if a chatmail relay is being used.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no good way to check if chatmail relay is used currently. There is is_chatmail, but it gets stuck being true if you add chatmail relay and then remove it. I think it's better to just always offer the option, worst case it will do nothing for non-chatmail users but they are unlikely to want to even click the option. Otherwise we are adding more is_chatmail checks and we want to get rid of is_chatmail.

Comment thread src/scheduler.rs
// Only doing this for chatmail relays to avoid
// accidentally deleting all emails in a shared mailbox.
let should_clear_imap_storage =
clear_storage_request_receiver.try_recv().is_ok() && session.is_chatmail();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to print an info to the log if the it was requested to clear storage, but is_chatmail() is false

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is_chatmail() is for an IMAP session, not global. So you can have two transports, the first that is not chatmail and another chatmail that you added later. If you request to clear storage, it will clear storage of chatmail transport, but not the first non-chatmail transport. Writing "not clearing non-chatmail" to the log each time looks like more log noise to me.

Copy link
Copy Markdown
Contributor

@r10s r10s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works, i tested with iOS at deltachat/deltachat-ios#3078

it seems to take some seconds until the connectivity view is actually updated, but that seems fine; the option is not for everyday use, in general, it is only the "last resort" and maybe only "for now", we aim to get better at automatic storage management

@link2xt link2xt force-pushed the link2xt/clear-all-relay-storage branch from 36c0fa1 to 10ab556 Compare April 19, 2026 11:20
@link2xt link2xt merged commit 3c25e4b into main Apr 19, 2026
31 checks passed
@link2xt link2xt deleted the link2xt/clear-all-relay-storage branch April 19, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add api to clear all relay storage

4 participants