Files

12 lines
489 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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