Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context::set_config(): Restart IO scheduler if needed (#5111) #5117

Merged
merged 3 commits into from
Feb 12, 2024

Conversation

iequidoo
Copy link
Collaborator

@iequidoo iequidoo commented Dec 20, 2023

See commit messages.

Fixes #5111

@iequidoo iequidoo marked this pull request as ready for review December 20, 2023 04:39
src/config.rs Outdated Show resolved Hide resolved
@iequidoo iequidoo force-pushed the iequidoo/apply_config branch 2 times, most recently from 7454397 to c4325a0 Compare December 21, 2023 22:48
@iequidoo iequidoo changed the title feat: Add Context::apply_config() and switch to it in public APIs (#5111) feat: Context::set_config(): Restart IO scheduler if needed (#5111) Dec 21, 2023
@iequidoo iequidoo marked this pull request as draft December 22, 2023 00:32
src/configure.rs Outdated Show resolved Hide resolved
@iequidoo iequidoo force-pushed the iequidoo/apply_config branch 2 times, most recently from 5694c87 to ed2636f Compare December 22, 2023 23:39
@iequidoo iequidoo marked this pull request as ready for review December 22, 2023 23:46
link2xt

This comment was marked as resolved.

@Hocuri
Copy link
Collaborator

Hocuri commented Dec 24, 2023

Note: Before we merge this, we should get some buy-in from UI people whether this actually makes their lives easier. Because we now have set_config, set_config_ex, set_raw_config, and set_config_inner, which does make reading the code harder. I personally never had any problem with needing to restart IO when writing UI code.

Or was there already a complaint from UI people about this?

@link2xt
Copy link
Collaborator

link2xt commented Dec 24, 2023

Note: Before we merge this, we should get some buy-in from UI people whether this actually makes their lives easier. Because we now have set_config, set_config_ex, set_raw_config, and set_config_inner, which does make reading the code harder. I personally never had any problem with needing to restart IO when writing UI code.

This is a bit ugly, but the only external API is still set_config.

Or was there already a complaint from UI people about this?

Android does it manually, it can be removed from Android then. JSON-RPC bindings already do this inside the bindings, now it is moved to the core.

There was no complaint from UI devs, but @missytake got a problem with the bot: #5111
This is not a nice API for writing the bots if changing the setting after configuring silently breaks delivery because messages are moved to DeltaChat folder but not downloaded.

@Hocuri
Copy link
Collaborator

Hocuri commented Dec 25, 2023

There was no complaint from UI devs, but @missytake got a problem with the bot: #5111
This is not a nice API for writing the bots if changing the setting after configuring silently breaks delivery because messages are moved to DeltaChat folder but not downloaded.

OK then it's nice that we fix this footgun 👍

@iequidoo
Copy link
Collaborator Author

I also don't like that now we have so much set_config*() stuff, set_config_internal() is just a syntactic sugar, i see no difference with just writing set_config_ex(Sync, ...) or set_config_ex(None, ...). But it doesn't matter much

src/imap.rs Outdated Show resolved Hide resolved
@iequidoo iequidoo marked this pull request as ready for review December 28, 2023 02:02
@iequidoo
Copy link
Collaborator Author

iequidoo commented Dec 28, 2023

And now this is the problem:
9.16 [events-ac2] INFO src/imap.rs:1873: got unsolicited response Other(ResponseData { raw: 4096, response: Data { status: Ok, code: Some(CopyUid(1703729259, [Uid(11)], [Uid(1)])), information: Some("Moved UIDs.") } })
"DeltaChat" needs to be fetched again if so.

Added another one fix for this. But not quite sure the server behaviour is correct.

EDIT: So, the tests passed 3 times w/o failures, apparently two extra fixes are working. But it's weird that several footguns were found while implementing such a simple thing.

@iequidoo iequidoo force-pushed the iequidoo/apply_config branch 6 times, most recently from 9328c39 to b9673ff Compare February 6, 2024 03:44
@iequidoo
Copy link
Collaborator Author

iequidoo commented Feb 6, 2024

Now only test_verified_group_vs_delete_server_after() failed which is expectable

@iequidoo iequidoo marked this pull request as ready for review February 6, 2024 04:12
@iequidoo iequidoo marked this pull request as draft February 6, 2024 19:58
@iequidoo iequidoo changed the base branch from main to iequidoo/create-mvbox February 6, 2024 20:04
@iequidoo iequidoo marked this pull request as ready for review February 6, 2024 20:05
@iequidoo iequidoo changed the title Context::set_config(): Restart IO scheduler if needed + related fixes (#5111) Context::set_config(): Restart IO scheduler if needed (#5111) Feb 6, 2024
@iequidoo
Copy link
Collaborator Author

iequidoo commented Feb 6, 2024

Moved a couple of fixes related to mvbox creation to #5251 for easier review.

EDIT: Can't easily split out fix: Create mvbox on setting mvbox_move to a separate review because of the text conflicts, so i suggest to review the PR as is.

Base automatically changed from iequidoo/create-mvbox to main February 9, 2024 02:39
src/config.rs Outdated Show resolved Hide resolved
Restart the IO scheduler if needed to make the new config value effective (for `MvboxMove,
OnlyFetchMvbox, SentboxWatch` currently). Also add `set_config_internal()` which doesn't affect
running the IO scheduler. The reason is that `Scheduler::start()` itself calls `set_config()`,
although not for the mentioned keys, but still, and also Rust complains about recursive async calls.
@iequidoo iequidoo merged commit 9933a42 into main Feb 12, 2024
38 checks passed
@iequidoo iequidoo deleted the iequidoo/apply_config branch February 12, 2024 18:41
r10s added a commit to deltachat/deltachat-ios that referenced this pull request Feb 14, 2024
r10s added a commit to deltachat/deltachat-android that referenced this pull request Feb 14, 2024
r10s added a commit to deltachat/deltachat-android that referenced this pull request Feb 14, 2024
r10s added a commit to deltachat/deltachat-ios that referenced this pull request Feb 14, 2024
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.

Automate I/O restarting when changing sentbox_watch, mvbox_move, only_fetch_mvbox etc.
3 participants