Skip to content

Commit

Permalink
imapc: Avoid duplicate FETCH BODY.PEEK[] when mail is already expunged
Browse files Browse the repository at this point in the history
When the first FETCH (e.g. as part of mail_prefetch()) indicated that the
mail is already expunged, there's no need to do it again.
  • Loading branch information
sirainen committed Feb 22, 2018
1 parent cc2b3ae commit fdabb36
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib-storage/index/imapc/imapc-mail.c
Expand Up @@ -310,6 +310,12 @@ imapc_mail_get_stream(struct mail *_mail, bool get_body,
mail_set_aborted(_mail);
return -1;
}
if (_mail->expunged) {
/* We already detected that the mail is expunged.
Don't spend time trying to FETCH it again. */
mail_set_expunged(_mail);
return -1;
}
fetch_field = get_body ||
(data->access_part & READ_BODY) != 0 ?
MAIL_FETCH_STREAM_BODY : MAIL_FETCH_STREAM_HEADER;
Expand Down

0 comments on commit fdabb36

Please sign in to comment.