From caeaa0bf73bc4121a29b7add7b5a5db24589595a Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sun, 11 Dec 2022 22:58:04 +0100 Subject: [PATCH] Add changed timeseries to queue --- ltsdb_json.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ltsdb_json.py b/ltsdb_json.py index faa64af..454f6d3 100644 --- a/ltsdb_json.py +++ b/ltsdb_json.py @@ -9,6 +9,7 @@ import time class LTS: base_dir = "data" + queue_dir = "queue" limit = 1000 def __init__(self, description=None, id=None): @@ -20,6 +21,7 @@ class LTS: m.update(bytes(serialized_description, encoding="UTF-8")) id = m.hexdigest() self.filename = self.base_dir + "/" + id + self.id = id try: with open(self.filename, "r") as fh: fcntl.flock(fh, fcntl.LOCK_SH) @@ -57,6 +59,8 @@ class LTS: fcntl.flock(fh, fcntl.LOCK_EX) json.dump({"description": self.description, "data": self.data}, fh) fh.truncate() + with open(self.queue_dir + "/" + self.id, "w") as fh: + pass def rebuild_index(self): t0 = time.time()