Skip to content

feat(core): implement ActiveSync status prefetch and bulk message fetch#212

Merged
ralflang merged 1 commit into
FRAMEWORK_6_0from
feat/activesync-sync-performance
Jul 24, 2026
Merged

feat(core): implement ActiveSync status prefetch and bulk message fetch#212
ralflang merged 1 commit into
FRAMEWORK_6_0from
feat/activesync-sync-performance

Conversation

@TDannhauer

@TDannhauer TDannhauer commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Motivation

The heartbeat/PING loop issued one IMAP STATUS round trip per pinged
mail folder per poll iteration, and message export fetched every email
individually (N+1). The library-side changes (companion PR horde/ActiveSync#91) call these new optional driver hooks; this PR provides
the IMAP-backed implementation. See horde/ActiveSync#88 for the analysis
and the full plan.

Changes

  • prefetchFolderStatus() filters email folders (drops OUTBOX,
    requires at least two mailboxes) and delegates to
    Horde_ActiveSync_Imap_Adapter::prefetchStatus() — a single
    multi-mailbox STATUS request (one LIST-STATUS round trip on servers
    that support RFC 5819). Failures are logged as a notice and polling
    falls back to per-mailbox STATUS.
  • getMessagesBulk() fetches a batch of email messages with one
    Imap_Adapter::getMessages() call (keyed by UID) and applies the same
    post-processing as getMessage() via the extracted
    _postProcessMailMessage() helper (last-verb lookup, draft flag, iTip
    response import). Non-email folders return an empty array (caller
    falls back per item); errors are logged as a notice and also fall
    back.
  • getMessage() email branch now uses _postProcessMailMessage()
    behaviour unchanged, logic shared.

Expected exceptions in new catch blocks: Horde_Exception (status
prefetch), Horde_Exception / Horde_ActiveSync_Exception (bulk fetch).

Test plan

  • Exporter/adapter behaviour covered by the new unit tests in the
    companion horde/ActiveSync PR (bulk consumption, per-id fallback,
    no-bulk equivalence).
  • Author deployment soak (iOS device): batched STATUS visible in
    logs, exports clean, no errors.
  • Multi-day soak with several concurrent devices.

Implement the optional batching hooks from horde/ActiveSync#88 in
Horde_Core_ActiveSync_Driver:

- prefetchFolderStatus() delegates to Imap_Adapter::prefetchStatus()
  for a single LIST-STATUS round trip covering all pinged mail folders.
- getMessagesBulk() fetches a batch of email messages in one IMAP fetch
  sequence and shares post-processing with getMessage() via the
  extracted _postProcessMailMessage() helper (last-verb lookup, draft
  flag, iTip response import).

Non-email folders, missing ids, and backend errors fall back to the
per-item calls with unchanged error semantics.

Refs horde/ActiveSync#88
@ralflang
ralflang merged commit a7b334d into FRAMEWORK_6_0 Jul 24, 2026
1 check failed
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.

2 participants