normalize uri when used as stream identifier

This commit is contained in:
2025-02-26 10:48:27 +01:00
parent 2f6bcad82f
commit 6a6e8b1bcc

View File

@ -78,8 +78,8 @@ class Stream(Base):
host, _, port = self.uri.partition(':') host, _, port = self.uri.partition(':')
# try to convert uri to host name # try to convert uri to host name
host = short_hostname(host) host = short_hostname(host)
self.tags['stream'] = f'{host}:{port}' self.uri = self.tags['stream'] = f'{host}:{port}'
print(self.uri, '=', self.tags['stream'], 'connected') print(f'{host}:{port}', '=', self.uri, 'connected')
self._buffer = [] self._buffer = []
self._deadline = INF self._deadline = INF
self._next_connect = 0 self._next_connect = 0
@ -284,7 +284,7 @@ class EventStream:
continue continue
device = stream.tags.get('device') device = stream.tags.get('device')
events.append(('stream', kwargs.get('instrument', '0'), events.append(('stream', kwargs.get('instrument', '0'),
{'device': device}, uri, int(time.time()))) {'device': device}, stream.uri, int(time.time())))
for name, stream in self.streams.items(): for name, stream in self.streams.items():
try: try:
if stream.get_events(events, maxevents): if stream.get_events(events, maxevents):