add a ratelimit decorator to {VbanCmd}.sendtext()

ip kwarg renamed to host.
This commit is contained in:
2026-03-02 23:20:45 +00:00
parent cf66ae252c
commit 86d0aa91c3
4 changed files with 42 additions and 29 deletions

View File

@@ -27,19 +27,13 @@ class Subscriber(threading.Thread):
def run(self):
while not self.stopped():
try:
for nbs in NBS:
sub_packet = VbanSubscribeHeader().to_bytes(
nbs, self._remote._get_next_framecounter()
)
self._remote.sock.sendto(
sub_packet, (self._remote.ip, self._remote.port)
)
except TimeoutError as e:
self.logger.exception(f'{type(e).__name__}: {e}')
raise VBANCMDConnectionError(
f'timeout sending subscription to {self._remote.ip}:{self._remote.port}'
) from e
for nbs in NBS:
sub_packet = VbanSubscribeHeader().to_bytes(
nbs, self._remote._get_next_framecounter()
)
self._remote.sock.sendto(
sub_packet, (self._remote.ip, self._remote.port)
)
self.wait_until_stopped(10)
self.logger.debug(f'terminating {self.name} thread')
@@ -128,7 +122,6 @@ class Producer(threading.Thread):
self.queue.put('pdirty')
if self._remote.event.ldirty:
self.queue.put('ldirty')
# time.sleep(self._remote.ratelimit)
self.logger.debug(f'terminating {self.name} thread')
self.queue.put(None)