Connecting to Chatmail takes a long time

Hello :wave:,
connecting to a Chatmail account in DC-iOS sometimes takes a long time.
It can last up to 40 seconds and seems to occur more frequently.
I’m not sure if it’s a bug or if it’s due to maintenance work on the chat server.
However, the problem has so far only occurred in DC-iOS.
Does anyone know more about it?

Indeed, it’s slow. This is with a quite fast connection:

pytest --durations=8 cmdeploy/src/cmdeploy/tests/online/test_0_login.py::test_login_basic_functioning 
============================================================================================================ test session starts ============================================================================================================
platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 -- /home/user/code/chatmail/venv/bin/python3
cachedir: .pytest_cache
Deltachat core=v1.132.0 sqlite=3.39.4 journal_mode=wal
rootdir: /home/user/code/chatmail/cmdeploy/src/cmdeploy/tests
configfile: pytest.ini
plugins: deltachat-1.132.0, cmdeploy-0.2, deltachat-rpc-client-1.127.0, xdist-3.5.0
collected 2 items                                                                                                                                                                                                                           

cmdeploy/src/cmdeploy/tests/online/test_0_login.py::test_login_basic_functioning[imap] PASSED                                                                                                                                         [ 50%]
cmdeploy/src/cmdeploy/tests/online/test_0_login.py::test_login_basic_functioning[smtp] PASSED                                                                                                                                         [100%]

============================================================================================================ slowest 8 durations ============================================================================================================
17.08s call     online/test_0_login.py::test_login_basic_functioning[smtp]
8.82s call     online/test_0_login.py::test_login_basic_functioning[imap]

(4 durations < 0.005s hidden.  Use -vv to show these durations.)
============================================================================================================ 2 passed in 25.99s =============================================================================================================

CPU & RAM seem normal.

Then again, cmdeploy bench is working well:

[$ pytest --pyargs cmdeploy.tests.online.benchmark -vrx]
============================================================================================================ test session starts ============================================================================================================
platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 -- /home/user/code/chatmail/venv/bin/python3
cachedir: .pytest_cache
Deltachat core=v1.132.0 sqlite=3.39.4 journal_mode=wal
rootdir: /home/user/code/chatmail
plugins: deltachat-1.132.0, cmdeploy-0.2, deltachat-rpc-client-1.127.0, xdist-3.5.0
collected 7 items                                                                                                                                                                                                                           

cmdeploy/src/cmdeploy/tests/online/benchmark.py::test_tls_imap PASSED                                                                                                                                                                 [ 14%]
cmdeploy/src/cmdeploy/tests/online/benchmark.py::test_login_imap PASSED                                                                                                                                                               [ 28%]
cmdeploy/src/cmdeploy/tests/online/benchmark.py::test_tls_smtp PASSED                                                                                                                                                                 [ 42%]
cmdeploy/src/cmdeploy/tests/online/benchmark.py::test_login_smtp PASSED                                                                                                                                                               [ 57%]
cmdeploy/src/cmdeploy/tests/online/benchmark.py::TestDC::test_autoconfigure PASSED                                                                                                                                                    [ 71%]
cmdeploy/src/cmdeploy/tests/online/benchmark.py::TestDC::test_ping_pong PASSED                                                                                                                                                        [ 85%]
cmdeploy/src/cmdeploy/tests/online/benchmark.py::TestDC::test_send_10_receive_10 PASSED                                                                                                                                               [100%]
============================================================================================================= benchmark results =============================================================================================================

benchmark name                 median    min    max
---------------------------------------------------
imap_connect                     0.14   0.13   0.14
imap_connect_and_login           0.23   0.21   0.25
smtp_connect                     0.20   0.19   0.37
smtp_connect_and_login           0.29   0.28   0.30
dc_autoconfig_and_idle_ready     1.34   1.32   1.38
dc_ping_pong                     0.59   0.56   1.30
dc_send_10_receive_10            2.65   2.35   2.67
============================================================================================================ 7 passed in 36.91s =============================================================================================================

There might be some bug where failed connection attempts (of being offline) stack up and trigger a timeout when it connects again. Have you played with stuff like flight mode?

No I haven’t. But I quit apps sometimes. I did it earlier because I thought it would save energy. Still trying to break the habit.

They are frozen on iOS, so not really save energy :wink:

Anyways let’s check if it is faster again when the next version releases in ~1,5 months (according to our internal “roadmap”)

I know, but occasionally I slip back into old habits. :grin: