summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--policyhandler/policy_receiver.py13
-rw-r--r--pom.xml2
-rw-r--r--setup.py2
-rw-r--r--version.properties2
4 files changed, 14 insertions, 5 deletions
diff --git a/policyhandler/policy_receiver.py b/policyhandler/policy_receiver.py
index 96afd59..3ae25fc 100644
--- a/policyhandler/policy_receiver.py
+++ b/policyhandler/policy_receiver.py
@@ -57,6 +57,7 @@ class _PolicyReceiver(Thread):
self._keep_running = True
self._settings = Settings(Config.FIELD_POLICY_ENGINE)
+ self._sleep_before_restarting = 5
self._web_socket_url = None
self._web_socket_sslopt = None
self._tls_wss_ca_mode = None
@@ -69,6 +70,7 @@ class _PolicyReceiver(Thread):
def reconfigure(self):
"""configure and reconfigure the web-socket"""
with self._lock:
+ self._sleep_before_restarting = 5
self._settings.set_config(Config.discovered_config)
changed, config = self._settings.get_by_key(Config.FIELD_POLICY_ENGINE)
@@ -126,7 +128,13 @@ class _PolicyReceiver(Thread):
self._stop_notifications()
if restarting:
- time.sleep(5)
+ with self._lock:
+ sleep_before_restarting = self._sleep_before_restarting
+ _PolicyReceiver._logger.info(
+ "going to sleep for %s secs before restarting policy-notifications",
+ sleep_before_restarting)
+
+ time.sleep(sleep_before_restarting)
if not self._get_keep_running():
break
@@ -205,7 +213,8 @@ class _PolicyReceiver(Thread):
def _on_ws_error(self, error):
"""report an error"""
- _PolicyReceiver._logger.exception("policy-notification error: %s", str(error))
+ _PolicyReceiver._logger.exception("policy-notification error %s", str(error))
+ self._sleep_before_restarting = 60 if isinstance(error, ssl.SSLError) else 5
def _on_ws_close(self, code, reason):
"""restart web-socket on close"""
diff --git a/pom.xml b/pom.xml
index 8b6ca2b..8a282b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<groupId>org.onap.dcaegen2.platform</groupId>
<artifactId>policy-handler</artifactId>
<name>dcaegen2-platform-policy-handler</name>
- <version>4.3.0-SNAPSHOT</version>
+ <version>4.3.1-SNAPSHOT</version>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
diff --git a/setup.py b/setup.py
index 2168cd6..c740a94 100644
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@ from setuptools import setup
setup(
name='policyhandler',
description='DCAE-Controller policy-handler to communicate with policy-engine',
- version="4.3.0",
+ version="4.3.1",
author='Alex Shatov',
packages=['policyhandler'],
zip_safe=False,
diff --git a/version.properties b/version.properties
index e77ddf3..af72773 100644
--- a/version.properties
+++ b/version.properties
@@ -1,6 +1,6 @@
major=4
minor=3
-patch=0
+patch=1
base_version=${major}.${minor}.${patch}
release_version=${base_version}
snapshot_version=${base_version}-SNAPSHOT