catch cancel exceptions cast by internfile()
This commit is contained in:
parent
7c245fe986
commit
e636480622
@ -36,6 +36,7 @@ static char rcsid[] = "@(#$Id: $ (C) 2005 J.F.Dockes";
|
|||||||
#include "readfile.h"
|
#include "readfile.h"
|
||||||
#include "conftree.h"
|
#include "conftree.h"
|
||||||
#include "transcode.h"
|
#include "transcode.h"
|
||||||
|
#include "cancelcheck.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -250,6 +251,8 @@ bool BeagleQueueIndexer::indexFromCache(const string& udi)
|
|||||||
if (!m_db)
|
if (!m_db)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
CancelCheck::instance().checkCancel();
|
||||||
|
|
||||||
Rcl::Doc dotdoc;
|
Rcl::Doc dotdoc;
|
||||||
string data;
|
string data;
|
||||||
string hittype;
|
string hittype;
|
||||||
@ -278,7 +281,13 @@ bool BeagleQueueIndexer::indexFromCache(const string& udi)
|
|||||||
FileInterner::FIF_doUseInputMimetype,
|
FileInterner::FIF_doUseInputMimetype,
|
||||||
dotdoc.mimetype);
|
dotdoc.mimetype);
|
||||||
string ipath;
|
string ipath;
|
||||||
FileInterner::Status fis = interner.internfile(doc, ipath);
|
FileInterner::Status fis;
|
||||||
|
try {
|
||||||
|
fis = interner.internfile(doc, ipath);
|
||||||
|
} catch (CancelExcept) {
|
||||||
|
LOGERR(("BeagleQueueIndexer: interrupted\n"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (fis != FileInterner::FIDone) {
|
if (fis != FileInterner::FIDone) {
|
||||||
LOGERR(("BeagleQueueIndexer: bad status from internfile\n"));
|
LOGERR(("BeagleQueueIndexer: bad status from internfile\n"));
|
||||||
return false;
|
return false;
|
||||||
@ -324,7 +333,12 @@ bool BeagleQueueIndexer::index()
|
|||||||
for (vector<string>::reverse_iterator it = alludis.rbegin();
|
for (vector<string>::reverse_iterator it = alludis.rbegin();
|
||||||
it != alludis.rend(); it++) {
|
it != alludis.rend(); it++) {
|
||||||
if (m_db->needUpdate(*it, "")) {
|
if (m_db->needUpdate(*it, "")) {
|
||||||
indexFromCache(*it);
|
try {
|
||||||
|
indexFromCache(*it);
|
||||||
|
} catch (CancelExcept) {
|
||||||
|
LOGERR(("BeagleQueueIndexer: interrupted\n"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -455,7 +469,13 @@ BeagleQueueIndexer::processone(const string &path,
|
|||||||
FileInterner::FIF_doUseInputMimetype,
|
FileInterner::FIF_doUseInputMimetype,
|
||||||
&dotdoc.mimetype);
|
&dotdoc.mimetype);
|
||||||
string ipath;
|
string ipath;
|
||||||
FileInterner::Status fis = interner.internfile(doc, ipath);
|
FileInterner::Status fis;
|
||||||
|
try {
|
||||||
|
fis = interner.internfile(doc, ipath);
|
||||||
|
} catch (CancelExcept) {
|
||||||
|
LOGERR(("BeagleQueueIndexer: interrupted\n"));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
if (fis != FileInterner::FIDone) {
|
if (fis != FileInterner::FIDone) {
|
||||||
LOGERR(("BeagleQueueIndexer: bad status from internfile\n"));
|
LOGERR(("BeagleQueueIndexer: bad status from internfile\n"));
|
||||||
goto out;
|
goto out;
|
||||||
|
|||||||
@ -48,6 +48,7 @@ static char rcsid[] = "@(#$Id: $ (C) 2009 J.F.Dockes";
|
|||||||
#include "smallut.h"
|
#include "smallut.h"
|
||||||
#include "wipedir.h"
|
#include "wipedir.h"
|
||||||
#include "fileudi.h"
|
#include "fileudi.h"
|
||||||
|
#include "cancelcheck.h"
|
||||||
|
|
||||||
// When using extended attributes, we have to use the ctime.
|
// When using extended attributes, we have to use the ctime.
|
||||||
// This is quite an expensive price to pay...
|
// This is quite an expensive price to pay...
|
||||||
@ -418,7 +419,12 @@ FsIndexer::processone(const std::string &fn, const struct stat *stp,
|
|||||||
while (fis == FileInterner::FIAgain) {
|
while (fis == FileInterner::FIAgain) {
|
||||||
doc.erase();
|
doc.erase();
|
||||||
string ipath;
|
string ipath;
|
||||||
fis = interner.internfile(doc, ipath);
|
try {
|
||||||
|
fis = interner.internfile(doc, ipath);
|
||||||
|
} catch (CancelExcept) {
|
||||||
|
LOGERR(("fsIndexer::processone: interrupted\n"));
|
||||||
|
return FsTreeWalker::FtwStop;
|
||||||
|
}
|
||||||
|
|
||||||
// Index at least the file name even if there was an error.
|
// Index at least the file name even if there was an error.
|
||||||
// We'll change the signature to ensure that the indexing will
|
// We'll change the signature to ensure that the indexing will
|
||||||
|
|||||||
@ -471,8 +471,8 @@ public:
|
|||||||
virtual status takeone(off_t offs, const string& udi, unsigned int dicsize,
|
virtual status takeone(off_t offs, const string& udi, unsigned int dicsize,
|
||||||
unsigned int datasize, unsigned int padsize)
|
unsigned int datasize, unsigned int padsize)
|
||||||
{
|
{
|
||||||
cerr << "offs " << offs << " udi [" << udi << "] dicsize " << dicsize
|
// cerr << "offs " << offs << " udi [" << udi << "] dicsize " << dicsize
|
||||||
<< " datasize " << datasize << " padsize " << padsize << endl;
|
// << " datasize " << datasize << " padsize " << padsize << endl;
|
||||||
if (!m_udi.compare(udi)) {
|
if (!m_udi.compare(udi)) {
|
||||||
m_instance++;
|
m_instance++;
|
||||||
m_offs = offs;
|
m_offs = offs;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user