core icon indicating copy to clipboard operation
core copied to clipboard

Immediately fetch after EXISTS response

Open Hocuri opened this issue 3 years ago • 2 comments

Currently, after the server sends an EXISTS response, we do all kinds of things before we fetch the newly-arrived message. This leads to increased answer times.

We should:

  • [x] remove the remaining jobs
  • [ ] move housekeeping to a separate loop
  • [ ] call store_seen_flags_on_imap() after fetching (currently we are calling it before)

#3240 was a draft PR that would have achieved the same goal in a different manner (and would have introduced new complexity).

Hocuri avatar Nov 28 '22 15:11 Hocuri

All the jobs have been removed, now they are explicitly called from inbox loop: #3457

link2xt avatar Nov 04 '23 18:11 link2xt

I made a new PR which simply moves fetch directly after IDLE: https://github.com/deltachat/deltachat-core-rust/pull/4974 Unlike old PR, new PR moves fetch call rather than doing fetch twice per iteration.

link2xt avatar Nov 10 '23 03:11 link2xt

When I tested it right now:

  • At the end of idle() and at the start of fetch_new_messages(), log the current system time (with milliseconds)
  • Then, to make a measurement:
    • Wait for at least 60s while not touching Delta Chat. This is important because e.g. update_recent_quota() is debounced to once a minute.
    • Receive a message
    • Calculate the difference in the timestamps in my head

the difference was up to around 70ms, on average around 30-50ms.

@hpk42, @link2xt and me concluded that this is not worth it right now because if you didn't receive a message for a minute then it doesn't matter if it arrives 50ms later. And when we fiddled around in the IMAP loop, we often introduced bugs - so it's just not worth the trouble right now.

I'll add it to project resurrection in case speed becomes a bigger priority in the future.

Hocuri avatar Aug 14 '24 18:08 Hocuri