From 8e5b4df2b0187f5d67b04b42551acdff8b002d75 Mon Sep 17 00:00:00 2001 From: mutantsan Date: Thu, 7 Nov 2024 15:07:53 +0200 Subject: [PATCH] fix: remove useless lock from EventWriteThread --- ckanext/event_audit/plugin.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ckanext/event_audit/plugin.py b/ckanext/event_audit/plugin.py index 2bff2be..c0dc796 100644 --- a/ckanext/event_audit/plugin.py +++ b/ckanext/event_audit/plugin.py @@ -20,7 +20,6 @@ def __init__(self, queue: queue.Queue[types.Event]): threading.Thread.__init__(self) self.queue = queue self.data = types.ThreadData(last_push=datetime.now(tz.utc), events=[]) - self.lock = threading.Lock() def run(self): while True: @@ -37,13 +36,12 @@ def run(self): ) >= config.get_batch_size() or self._is_time_to_push( self.data["last_push"] ): - with self.lock: - repo = utils.get_active_repo() + repo = utils.get_active_repo() - repo.write_events(self.data["events"]) + repo.write_events(self.data["events"]) - self.data["events"] = [] - self.data["last_push"] = datetime.now(tz.utc) + self.data["events"] = [] + self.data["last_push"] = datetime.now(tz.utc) self.queue.task_done()