From c62a1a2bd3773f7c9ad04d6a1a8e2c2bdc4d3a46 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 13 Dec 2017 01:04:04 +0100 Subject: [PATCH] Initialize the local fifo only when the backend is run --- platypush/backend/local/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platypush/backend/local/__init__.py b/platypush/backend/local/__init__.py index 9cdd9d9070..9cba0581eb 100644 --- a/platypush/backend/local/__init__.py +++ b/platypush/backend/local/__init__.py @@ -8,10 +8,6 @@ from .. import Backend class LocalBackend(Backend): def _init(self, fifo): self.fifo = fifo - try: os.mkfifo(self.fifo) - except FileExistsError as e: pass - logging.info('Initialized local backend on fifo {}'.format(self.fifo)) - def send_msg(self, msg): if isinstance(msg, dict): msg = json.dumps(msg) @@ -24,6 +20,10 @@ class LocalBackend(Backend): f.write(msg) def run(self): + try: os.mkfifo(self.fifo) + except FileExistsError as e: pass + logging.info('Initialized local backend on fifo {}'.format(self.fifo)) + with open(self.fifo, 'rb', 0) as f: while True: try: