netdata_tsrelay.nim
changeset 4 f3d83bdd7877
parent 1 160338bb2822
child 5 a1276c3d39eb
--- a/netdata_tsrelay.nim	Mon Feb 12 13:00:25 2018 -0800
+++ b/netdata_tsrelay.nim	Mon Feb 12 13:25:26 2018 -0800
@@ -129,10 +129,14 @@
         return
 
     var samples = parse_data( raw_data )
+    if samples.len == 0: return
+
+    db.exec sql( "BEGIN" )
     for timestamp, sample in samples:
         var host = sample[ "hostname" ].get_str
         sample.delete( "hostname" )
         db.exec sql( INSERT_SQL ), timestamp, host, sample
+    db.exec sql( "COMMIT" )
 
 proc serverloop: void =
     ## Open a database connection, bind to the listening socket,