From 204baa257cbf4a45e1b0c86ecc8081cb5df75c63 Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Thu, 4 Apr 2024 16:33:49 +0200 Subject: [PATCH] Make sure attributes are polled when subscribing to them --- tangostationcontrol/tangostationcontrol/common/events.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tangostationcontrol/tangostationcontrol/common/events.py b/tangostationcontrol/tangostationcontrol/common/events.py index 89028fef3..eac5e9c98 100644 --- a/tangostationcontrol/tangostationcontrol/common/events.py +++ b/tangostationcontrol/tangostationcontrol/common/events.py @@ -8,6 +8,7 @@ from prometheus_client import Counter from tango import DeviceProxy, EventType from tangostationcontrol.common.lofar_logging import log_exceptions +from tangostationcontrol.common.constants import DEFAULT_POLLING_PERIOD_MS from tangostationcontrol.metrics import AttributeMetric logger = logging.getLogger() @@ -87,11 +88,8 @@ class EventSubscriptions: # make sure the attribute is polled, otherwise we wont receive event if not proxy.is_attribute_polled(attr_name): - logger.error( - f"Error, no polling_period set for attribute \ - {proxy.name()}/{attr_name}. \ - We will not get any events without a polling_period" - ) + logger.info(f"Enabling polling for {proxy.name()}/{attr_name}.") + proxy.poll_attribute(attr_name, DEFAULT_POLLING_PERIOD_MS) # subscribe event_id = proxy.subscribe_event( -- GitLab