From 5eda0fe20e8b9d1f8be7734c521ce240df3401e7 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Fri, 24 Jun 2016 08:06:52 +0200 Subject: [PATCH] [fix] avoid a possible thread problem --- src/yunohost/journals.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/yunohost/journals.py b/src/yunohost/journals.py index 0be01853f..b8807fa94 100644 --- a/src/yunohost/journals.py +++ b/src/yunohost/journals.py @@ -74,7 +74,9 @@ class Journal(object): self.name = name self.category = category self.first_write = True - self.started_at = None + + # this help uniformise file name and avoir threads concurrency errors + self.started_at = datetime.now() self.path = os.path.join(JOURNALS_PATH, category) @@ -101,8 +103,6 @@ class Journal(object): self.fd.flush() def _do_first_write(self): - self.started_at = datetime.now() - if not os.path.exists(self.path): os.makedirs(self.path)