From 7b9a03eaa6cc120807a4727003abafea4aaa297a Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Tue, 20 May 2025 17:29:00 +0200 Subject: [PATCH] removing a streams must never be pre-dated --- seinflux.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/seinflux.py b/seinflux.py index 9773117..8e034e8 100644 --- a/seinflux.py +++ b/seinflux.py @@ -381,12 +381,13 @@ class SEHistory(InfluxDBWrapper): :param ts: the time or None when now """ flag = value is not None - try: - previns, prevts = self.get_instrument(stream, ts, **tags) - if prevts is not None and (previns is None or (ts or 1e10) < prevts): - ts = prevts + 0.001 - except Exception as e: - print(f'Exception in get_instrument {e!r}') + if flag: + try: + previns, prevts = self.get_instrument(stream, ts, **tags) + if prevts is not None and (previns is None or (ts or 1e10) < prevts): + ts = prevts + 0.001 + except Exception as e: + print(f'Exception in get_instrument {e!r}') tags['stream'] = stream if flag: tags['instrument'] = value