X-Git-Url: https://git.rvb.name/weathermon.git/blobdiff_plain/529af1a8e82eff19d98f6f60a98fc6d5e3e8d95d..21260a74f42a65603317d1938fac675d5eef6635:/bin/weathermon diff --git a/bin/weathermon b/bin/weathermon index bd9ca80..dbffa82 100755 --- a/bin/weathermon +++ b/bin/weathermon @@ -105,13 +105,17 @@ function submitValue(type,id,param,val) if code ~= 200 and backlog_con then printLog("writing record to backlog...") + backlog_con:execute('BEGIN TRANSACTION') backlog_con:execute(string.format("INSERT INTO queue(time_stamp,sensor_id,sensor,param,value) VALUES (datetime('now','localtime'),'%s','%s','%s',%f)",id,type,param,val)) + backlog_con:execute('COMMIT') end end if logdb then + log_con:execute('BEGIN TRANSACTION') log_con:execute(string.format("INSERT INTO log(time_stamp,sensor_id,sensor,param,value) VALUES (datetime('now','localtime'),'%s','%s','%s',%f)",id,type,param,val)) + log_con:execute('COMMIT') end end @@ -408,7 +412,6 @@ while 1 do io.close(f) end) end - end) end