12 lines
489 B
Python
12 lines
489 B
Python
DEFAULT_KIB_PER_SECOND = 500
|
||
MAX_KIB_PER_SECOND = 10240
|
||
MAX_BYTES_PER_SECOND = MAX_KIB_PER_SECOND * 1024
|
||
# Keep the DB credit bound aligned with the allocator's existing 200 ms burst.
|
||
MAX_BUCKET_MICROBYTES = MAX_BYTES_PER_SECOND * 200 * 1000
|
||
|
||
|
||
def _limit_in_bytes(value):
|
||
if type(value) is not int or not 1 <= value <= MAX_KIB_PER_SECOND:
|
||
raise ValueError(f"Account proxy speed request must be an integer in 1–{MAX_KIB_PER_SECOND} KiB/s.")
|
||
return value * 1024
|