better handle aspell errors: dont exit from monitor on aux db creation failure, and dont retry forever
This commit is contained in:
parent
134edf9c45
commit
3db31b4079
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.53 2007-02-08 17:05:12 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.54 2007-05-21 09:00:28 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -201,8 +201,15 @@ bool DbIndexer::createAspellDict()
|
|||||||
{
|
{
|
||||||
LOGDEB2(("DbIndexer::createAspellDict()\n"));
|
LOGDEB2(("DbIndexer::createAspellDict()\n"));
|
||||||
#ifdef RCL_USE_ASPELL
|
#ifdef RCL_USE_ASPELL
|
||||||
bool noaspell = false;
|
// For the benefit of the real-time indexer, we only initialize
|
||||||
m_config->getConfParam("noaspell", &noaspell);
|
// noaspell from the configuration once. It can then be set to
|
||||||
|
// true if dictionary generation fails, which avoids retrying
|
||||||
|
// it forever.
|
||||||
|
static int noaspell = -12345;
|
||||||
|
if (noaspell == -12345) {
|
||||||
|
noaspell = false;
|
||||||
|
m_config->getConfParam("noaspell", &noaspell);
|
||||||
|
}
|
||||||
if (noaspell)
|
if (noaspell)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -213,18 +220,21 @@ bool DbIndexer::createAspellDict()
|
|||||||
if (!aspell.init(reason)) {
|
if (!aspell.init(reason)) {
|
||||||
LOGERR(("DbIndexer::createAspellDict: aspell init failed: %s\n",
|
LOGERR(("DbIndexer::createAspellDict: aspell init failed: %s\n",
|
||||||
reason.c_str()));
|
reason.c_str()));
|
||||||
|
noaspell = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LOGDEB(("DbIndexer::createAspellDict: creating dictionary\n"));
|
LOGDEB(("DbIndexer::createAspellDict: creating dictionary\n"));
|
||||||
if (!aspell.buildDict(m_db, reason)) {
|
if (!aspell.buildDict(m_db, reason)) {
|
||||||
LOGERR(("DbIndexer::createAspellDict: aspell buildDict failed: %s\n",
|
LOGERR(("DbIndexer::createAspellDict: aspell buildDict failed: %s\n",
|
||||||
reason.c_str()));
|
reason.c_str()));
|
||||||
|
noaspell = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// The close would be done in our destructor, but we want status here
|
// The close would be done in our destructor, but we want status here
|
||||||
if (!m_db.close()) {
|
if (!m_db.close()) {
|
||||||
LOGERR(("DbIndexer::indexfiles: error closing database in %s\n",
|
LOGERR(("DbIndexer::indexfiles: error closing database in %s\n",
|
||||||
m_dbdir.c_str()));
|
m_dbdir.c_str()));
|
||||||
|
noaspell = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#ifdef RCL_MONITOR
|
#ifdef RCL_MONITOR
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: rclmonprc.cpp,v 1.10 2006-12-24 07:40:26 dockes Exp $ (C) 2006 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: rclmonprc.cpp,v 1.11 2007-05-21 09:00:29 dockes Exp $ (C) 2006 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -340,11 +340,16 @@ bool startMonitor(RclConfig *conf, int opts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Recreate the auxiliary dbs every hour.
|
// Recreate the auxiliary dbs every hour.
|
||||||
if (time(0) - lastauxtime > 60 *60) {
|
const int auxinterval = 60 *60;
|
||||||
|
if (didsomething && time(0) - lastauxtime > auxinterval) {
|
||||||
lastauxtime = time(0);
|
lastauxtime = time(0);
|
||||||
didsomething = false;
|
didsomething = false;
|
||||||
if (!createAuxDbs(conf))
|
if (!createAuxDbs(conf)) {
|
||||||
break;
|
// We used to bail out on error here. Not anymore,
|
||||||
|
// because this is most of the time due to a failure
|
||||||
|
// of aspell dictionary generation, which is not
|
||||||
|
// critical.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lock queue before waiting again
|
// Lock queue before waiting again
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user