Created
January 3, 2023 22:17
-
-
Save PouyaEsmaeili/3758d0fac4c8709c8b0391a971959627 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _get_lock_name(self, client_id: str, resource_id: str) -> str: | |
if self._limit_per_client: | |
return f'{resource_id}-lock' | |
return f'{client_id}-{resource_id}-lock' | |
def _get_log_pattern(self, client_id: str, resource_id: str) -> str: | |
if self._limit_per_client: | |
return f'{resource_id}-*' | |
return f'{client_id}-{resource_id}-*' | |
def _generate_log_name(self, client_id: str, resource_id: str) -> str: | |
padding = ''.join( | |
choices( | |
ascii_uppercase + ascii_lowercase, | |
k=10, | |
) | |
) | |
if self._limit_per_client: | |
return f'{resource_id}-{padding}' | |
return f'{client_id}-{resource_id}-{padding}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment