From 44962dd919189fc7bec2bce90ef55da011bb460c Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 20 Sep 2018 10:59:18 +0000 Subject: [PATCH] Removed timeout from get_plugin lock; Added Redis server to tests configuration --- platypush/context/__init__.py | 14 +------------- tests/etc/config.yaml | 3 +++ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/platypush/context/__init__.py b/platypush/context/__init__.py index 5667293b1..95945b589 100644 --- a/platypush/context/__init__.py +++ b/platypush/context/__init__.py @@ -2,7 +2,6 @@ import importlib import logging from threading import Lock -from contextlib import contextmanager from ..config import Config @@ -21,13 +20,6 @@ plugins_init_locks = {} # Reference to the main application bus main_bus = None -@contextmanager -def acquire_timeout(lock, timeout): - acquired = lock.acquire(timeout=timeout) - yield acquired - if acquired: - lock.release() - def register_backends(bus=None, global_scope=False, **kwargs): """ Initialize the backend objects based on the configuration and returns a name -> backend_instance map. @@ -106,11 +98,7 @@ def get_plugin(plugin_name, reload=False): logger.warning('No such class in {}: {}'.format(plugin_name, cls_name)) raise RuntimeError(e) - with acquire_timeout(plugins_init_locks[plugin_name], 5) as acquired: - if not acquired: - logger.warning('Lock expired on get_plugin({}), resetting it'.format(plugin_name)) - plugins_init_locks[plugin_name] = Lock() - + with plugins_init_locks[plugin_name]: if plugins.get(plugin_name) and not reload: return plugins[plugin_name] plugins[plugin_name] = plugin_class(**plugin_conf) diff --git a/tests/etc/config.yaml b/tests/etc/config.yaml index e97c1bb2a..158343049 100644 --- a/tests/etc/config.yaml +++ b/tests/etc/config.yaml @@ -2,3 +2,6 @@ backend.http: port: 8123 disable_websocket: True +backend.redis: + disabled: False +