Mercurial Hosting > luan
changeset 1399:38a1c1b4279a
fix
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 11 Sep 2019 16:28:38 -0600 |
parents | 67c0e47b5be3 |
children | 221eedb0f54e |
files | examples/blog/src/lib/Db.luan src/luan/modules/lucene/LuceneIndex.java src/luan/modules/lucene/PostgresBackup.java |
diffstat | 3 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/examples/blog/src/lib/Db.luan Wed Sep 11 15:48:49 2019 -0600 +++ b/examples/blog/src/lib/Db.luan Wed Sep 11 16:28:38 2019 -0600 @@ -4,6 +4,8 @@ local Lucene = require "luan:lucene/Lucene.luan" local Io = require "luan:Io.luan" local Hosting = require "luan:host/Hosting.luan" +local Time = require "luan:Time.luan" +local Thread = require "luan:Thread.luan" local Logging = require "luan:logging/Logging.luan" local logger = Logging.logger "Db" @@ -36,5 +38,6 @@ Db.db = Db.new("site:/private/local/lucene") Db.db.restore_from_postgres() -Db.db.check() +Thread.schedule( Db.db.check, { delay=0, repeating_delay=Time.period{minutes=1}, daemon = true } ) + return Db
--- a/src/luan/modules/lucene/LuceneIndex.java Wed Sep 11 15:48:49 2019 -0600 +++ b/src/luan/modules/lucene/LuceneIndex.java Wed Sep 11 16:28:38 2019 -0600 @@ -970,7 +970,7 @@ } private boolean equal(LuanTable t1,LuanTable t2) throws LuanException { - return t1.asMap().equals(t2.asMap()); + return t1!=null && t2!=null && t1.asMap().equals(t2.asMap()); } }
--- a/src/luan/modules/lucene/PostgresBackup.java Wed Sep 11 15:48:49 2019 -0600 +++ b/src/luan/modules/lucene/PostgresBackup.java Wed Sep 11 16:28:38 2019 -0600 @@ -224,7 +224,8 @@ LuanTable getDoc(long id) throws SQLException, LuanException { pstmt.setLong(1,id); ResultSet rs = pstmt.executeQuery(); - rs.next(); + if( !rs.next() ) + return null; String data = rs.getString("data"); LuanTable doc = (LuanTable)eval(data,env); return doc;