mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
rate_limiter: Extract KEY_PREFIX to redis_utils.
(cherry picked from commit 630335142a)
This commit is contained in:
committed by
Tim Abbott
parent
0afcfccd20
commit
2deb166a23
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
import re
|
||||
import secrets
|
||||
from typing import Any, Dict, Mapping, Optional
|
||||
@@ -84,3 +85,11 @@ def validate_key_fits_format(key: str, key_format: str) -> None:
|
||||
|
||||
if not re.fullmatch(regex, key):
|
||||
raise ZulipRedisKeyOfWrongFormatError(f"{key} does not match format {key_format}")
|
||||
|
||||
|
||||
REDIS_KEY_PREFIX = ""
|
||||
|
||||
|
||||
def bounce_redis_key_prefix_for_testing(test_name: str) -> None:
|
||||
global REDIS_KEY_PREFIX
|
||||
REDIS_KEY_PREFIX = test_name + ":" + str(os.getpid()) + ":"
|
||||
|
||||
Reference in New Issue
Block a user