Skip to content
Verified Commit 68facf36 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

ImapSet: optimize the set before serialization

Summary:
Client code usually generates the ImapSet by simply passing it a vector of
IDs or just by calling ImapSet::add() in a for loop for individual IDs. This
creates potentially massive amount of intervals. This change ads a method
that will optimize the ImapSet by merging adjacent or overlapping intervals.

I ran into this trying to move about 28'000 emails to Trash in KMail. The IMAP
resource calls ImapSet::add() in a for loop to add each Item to be moved into
the set. This just created 28'000 single-UID intervals and the resulting request
string was so long that my Courier IMAP server just dropped the connection, so
the IMAP resource reconnected and tried to send the same massive request again
and again and again...

By optimizing the set the string size is reduced from nearly 156 kilobytes
down to less than 4 kilobytes.

Reviewers: #kde_pim, vkrause

Reviewed By: #kde_pim, vkrause

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D28944
parent 4da8833c
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment