state: use json.dumps() instead of dump()

This actually 10 times faster, because everything is stored in the
memory.

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2018-09-04 19:09:25 +03:00
parent 1a18c4d3f1
commit 8d8a94bcb7
+2 -1
View File
@@ -93,8 +93,9 @@ class State(object):
return
with SignalHandler():
j = json.dumps(self._db)
with open(self.state_file, 'w+') as fd:
json.dump(self._db, fd)
fd.write(j)
def dump(self):
with self._lock: