Handler timeout should not interrupt the whole indexing pass

This commit is contained in:
Jean-Francois Dockes 2016-04-14 15:48:01 +02:00
parent 84b4378acb
commit 918626c11d
3 changed files with 11 additions and 2 deletions

View file

@ -60,7 +60,7 @@ void MEAdv::newData(int n)
time(0L) - m_start > m_filtermaxseconds) {
LOGERR(("MimeHandlerExec: filter timeout (%d S)\n",
m_filtermaxseconds));
CancelCheck::instance().setCancel();
throw HandlerTimeout();
}
// If a cancel request was set by the signal handler (or by us
// just above), this will raise an exception. Another approach
@ -117,6 +117,9 @@ bool MimeHandlerExec::next_document()
int status;
try {
status = mexec.doexec(cmd, myparams, 0, &output);
} catch (HandlerTimeout) {
LOGERR(("MimeHandlerExec: handler timeout\n"));
status = 0x110f;
} catch (CancelExcept) {
LOGERR(("MimeHandlerExec: cancelled\n"));
status = 0x110f;

View file

@ -23,6 +23,8 @@
#include "mimehandler.h"
#include "execmd.h"
class HandlerTimeout {};
/**
* Turn external document into internal one by executing an external filter.
*

View file

@ -228,8 +228,12 @@ bool MimeHandlerExecMultiple::next_document()
m_cmd.zapChild();
return false;
}
} catch (HandlerTimeout) {
LOGINFO(("MHExecMultiple: timeout\n"));
m_cmd.zapChild();
return false;
} catch (CancelExcept) {
LOGINFO(("MHExecMultiple: timeout or interrupt\n"));
LOGINFO(("MHExecMultiple: interrupt\n"));
m_cmd.zapChild();
return false;
}