Skip to content

Commit

Permalink
Misc: code structure update.
Browse files Browse the repository at this point in the history
  • Loading branch information
remiliacn committed Oct 17, 2024
1 parent 2960034 commit 9946d4a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Services/rate_limiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from Services.util.common_util import time_to_literal
from model.common_model import RateLimitStatus
from util.db_utils import fetch_one_or_default


class UserLimitModifier:
Expand Down Expand Up @@ -110,7 +111,7 @@ async def get_user_hit(self, function_name: str, user_id: Union[str, int]):
""", (function_name, user_id)
).fetchone()

return result if isinstance(result, int) else result[0] if result is not None and result[0] is not None else 0
return fetch_one_or_default(result, 0)

async def _query_group_permission(
self,
Expand Down

0 comments on commit 9946d4a

Please sign in to comment.