]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fts: If Tika returns 500, retry it a couple of times and then fallback to ignoring...
authorTimo Sirainen <tss@iki.fi>
Fri, 7 Aug 2015 08:31:29 +0000 (11:31 +0300)
committerTimo Sirainen <tss@iki.fi>
Fri, 7 Aug 2015 08:31:29 +0000 (11:31 +0300)
src/plugins/fts/fts-parser-tika.c

index 0cd7544b72cfff35ac319e5bfd8de2998e3a1f58..148ddaa5910222b2ca8959a15cc3188e33b65b98 100644 (file)
@@ -103,6 +103,21 @@ fts_tika_parser_response(const struct http_response *response,
                }
                parser->payload = i_stream_create_from_data("", 0);
                break;
+       case 500:
+               /* Server Error - the problem could be anything (in Tika or
+                  HTTP server or proxy) and might be retriable, but Tika has
+                  trouble processing some documents and throws up this error
+                  every time for those documents. So we try retrying this a
+                  couple of times, but if that doesn't work we'll just ignore
+                  it. */
+               if (http_client_request_try_retry(parser->http_req))
+                       return;
+               i_info("fts_tika: PUT %s failed: %u %s - ignoring",
+                      mail_user_plugin_getenv(parser->user, "fts_tika"),
+                      response->status, response->reason);
+               parser->payload = i_stream_create_from_data("", 0);
+               break;
+
        default:
                i_error("fts_tika: PUT %s failed: %u %s",
                        mail_user_plugin_getenv(parser->user, "fts_tika"),