From 42f35855ea8ff7f40d78c1560d600e1b3695f899 Mon Sep 17 00:00:00 2001 From: rofl0r Date: Sat, 5 Jan 2019 16:39:55 +0000 Subject: [PATCH] use a variable for the min number of jobs to collect this variable determines after how many results the db is written to. with a low value, it is written often and could more lock issues if 2 threads concur for the db. --- proxywatchd.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proxywatchd.py b/proxywatchd.py index 7562657..a8145a9 100644 --- a/proxywatchd.py +++ b/proxywatchd.py @@ -136,6 +136,7 @@ class Proxywatchd(): self.mysqlite.close() self.mysqlite = None + self.submit_after = 200 # number of collected jobs before writing db self.echoise = time.time() - 3600; self.ticks = time.time() - 3600; self.jobs = [] @@ -199,7 +200,7 @@ class Proxywatchd(): self.collect_work() - if len(self.collected) > 50: + if len(self.collected) > self.submit_after: self.submit_collected() time.sleep(1)