core icon indicating copy to clipboard operation
core copied to clipboard

Add CFFI API to create event emitter before account manager

Open link2xt opened this issue 1 month ago • 0 comments

We have an issue upgrading from 2.25 to 2.33 caused by SQL migration being too slow: https://github.com/chatmail/core/issues/7602 Application gets killed by the OS because dc_accounts_new takes too long. There are no logs from the migrations available, because application does not even get a chance to call dc_accounts_get_event_emitter before migrations finished.

To make it possible to get logs before migrations finish, we need to be able to create event channel separately with a new API dc_accounts_event_emitter_new and then have API to create account manager with existing event channel dc_accounts_new_with_event_emitter.

JSON-RPC server could also use this to create event emitter first and then allow to call get_next_event before account manager is created, but the whole JSON-RPC object is centered around account manager so this will require some locks around account manager to wait for it in JSON-RPC calls that need it, can be treated as out of scope for this issue.

Not high priority as Android will need a workaround to turn "background ANR" into "foreground ANR" anyway: https://github.com/deltachat/deltachat-android/issues/4116#issuecomment-3647739465, then current problem will be solved by the user having to wait on the blank screen but that only happens on upgrade.

link2xt avatar Dec 12 '25 19:12 link2xt