# HG changeset patch # User Mahlon E. Smith # Date 1518470726 28800 # Node ID f3d83bdd78772e20504d5315649513c0c0ae89db # Parent f34855556f4d8121ea7b2eb20c1ba9b70692232c Wrap commits in a transaction. diff -r f34855556f4d -r f3d83bdd7877 netdata_tsrelay.nim --- 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,