DB "canary" added - with fail/restart when connection dropped
[weathermon.git] / bin / weather-filter
index 1fc798fbb23bb4fe2a7699e420d45082f7a7d2be..3acca7b9569222281a6a8470130df146891d5f72 100755 (executable)
@@ -42,6 +42,10 @@ function filter_data(dataset,width)
     width = 7
   end  
 
     width = 7
   end  
 
+  if #dataset <= width then
+    return dataset
+  end  
+
   local result = {}
   
   local window_spread = math.floor(width/2)
   local result = {}
   
   local window_spread = math.floor(width/2)
@@ -171,7 +175,7 @@ local day = arg[3]
 
 local dbdriver = require "luasql.sqlite3"
 env = assert(dbdriver.sqlite3())
 
 local dbdriver = require "luasql.sqlite3"
 env = assert(dbdriver.sqlite3())
-con = assert(env:connect(logdb))
+con = assert(env:connect(logdb,'READONLY'))
 
 if command == "list" then
 
 
 if command == "list" then