diff --git a/README.md b/README.md index de19b1f..a7c6936 100644 --- a/README.md +++ b/README.md @@ -548,7 +548,7 @@ You may pass the following optional keyword arguments: - `channel`: int=0, channel on which to send the UDP requests. - `pdirty`: boolean=False, parameter updates - `ldirty`: boolean=False, level updates -- `script_ratelimit`: float=0.05, default to 20 script requests per second. This affects vban.sendtext() specifically. +- `script_ratelimit`: float | None=None, ratelimit for vban.sendtext() specifically. - `timeout`: int=5, timeout for socket operations. - `disable_rt_listeners`: boolean=False, set `True` if you don't wish to receive RT packets. - You can still send Matrix string requests ending with `?` and receive a response. diff --git a/vban_cmd/factory.py b/vban_cmd/factory.py index afc3e4e..68e42c1 100644 --- a/vban_cmd/factory.py +++ b/vban_cmd/factory.py @@ -89,7 +89,7 @@ class FactoryBase(VbanCmd): 'streamname': 'Command1', 'bps': 256000, 'channel': 0, - 'script_ratelimit': 0.05, # 20 commands per second, to avoid overloading Voicemeeter + 'script_ratelimit': None, # if None or 0, no rate limit applied to script commands 'timeout': 5, # timeout on socket operations, in seconds 'disable_rt_listeners': False, 'sync': False, diff --git a/vban_cmd/util.py b/vban_cmd/util.py index b20348d..fb30284 100644 --- a/vban_cmd/util.py +++ b/vban_cmd/util.py @@ -5,12 +5,12 @@ from typing import Iterator from .error import VBANCMDConnectionError -def ratelimit(func): - """ratelimit decorator for {VbanCmd}.sendtext, to prevent flooding the network with script requests.""" +def script_ratelimit(func): + """script_ratelimit decorator for {VbanCmd}.sendtext, to prevent flooding the network with script requests.""" def wrapper(*args, **kwargs): self, *rem = args - if self.script_ratelimit > 0: + if self.script_ratelimit: now = time.time() elapsed = now - self._last_script_request_time if elapsed < self.script_ratelimit: