Skip to content

Commit

Permalink
fts: Make sure may_need_retry is reset between attempts.
Browse files Browse the repository at this point in the history
It wasn't if the second attempt failed early.
  • Loading branch information
sirainen authored and cmouse committed Dec 15, 2017
1 parent f4c18fa commit d8ebe88
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/plugins/fts/fts-build-mail.c
Expand Up @@ -465,7 +465,7 @@ static int
fts_build_mail_real(struct fts_backend_update_context *update_ctx,
struct mail *mail,
const char **error_msg,
bool *may_need_retry)
bool *may_need_retry_r)
{
struct fts_mail_build_context ctx;
struct istream *input;
Expand All @@ -478,6 +478,7 @@ fts_build_mail_real(struct fts_backend_update_context *update_ctx,
const char *error;
int ret;

*may_need_retry_r = FALSE;
if (mail_get_stream_because(mail, NULL, NULL, "fts indexing", &input) < 0) {
if (mail->expunged)
return 0;
Expand Down Expand Up @@ -517,7 +518,7 @@ fts_build_mail_real(struct fts_backend_update_context *update_ctx,
/* body part changed. we're now parsing the end of
boundary, possibly followed by message epilogue */
if (ctx.body_parser != NULL) {
if (fts_body_parser_finish(&ctx, error_msg, may_need_retry) < 0) {
if (fts_body_parser_finish(&ctx, error_msg, may_need_retry_r) < 0) {
ret = -1;
break;
}
Expand Down Expand Up @@ -574,7 +575,7 @@ fts_build_mail_real(struct fts_backend_update_context *update_ctx,
}
if (ctx.body_parser != NULL) {
if (ret == 0)
ret = fts_body_parser_finish(&ctx, error_msg, may_need_retry);
ret = fts_body_parser_finish(&ctx, error_msg, may_need_retry_r);
else
(void)fts_parser_deinit(&ctx.body_parser, NULL);
}
Expand All @@ -600,7 +601,7 @@ int fts_build_mail(struct fts_backend_update_context *update_ctx,
/* Number of attempts to be taken if retry is needed */
unsigned int attempts = 2;
const char *error_msg;
bool may_need_retry = FALSE;
bool may_need_retry;

T_BEGIN {
for (;;) {
Expand Down

0 comments on commit d8ebe88

Please sign in to comment.