bugfix: softfail when the hotlist DB is temporarily not readable

This commit is contained in:
Alexandre Storelli 2019-03-27 13:46:39 +01:00
parent c51a6ee571
commit 322c07bb20
1 changed files with 7 additions and 1 deletions

View File

@ -157,7 +157,13 @@ class Hotlist extends Writable {
"INNER JOIN tracks ON tracks.id = track_id " +
"WHERE finger IN " + inStr + ";", fingerVector, function(err, res) {
if (err) return log.error("onFingers: " + self.country + "_" + self.name + " query error=" + err);
if (err) {
// sometimes the hotlist is not fully written to disk when it is opened
// Error: SQLITE_ERROR: too many SQL variables
// softfail in such circumstances
if (callback) callback(null, consts.EMPTY_OUTPUT);
return log.error("onFingers: " + self.country + "_" + self.name + " query error=" + err);
}
if (!res || !res.length) {
//log.warn("onFingers: no results for a query of " + tcodes.length);
if (callback) callback(null, consts.EMPTY_OUTPUT);