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