Skip to content

Commit

Permalink
remove clock-exception
Browse files Browse the repository at this point in the history
  • Loading branch information
vutran1710 committed Mar 17, 2024
1 parent 2341afb commit 20fd688
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
6 changes: 1 addition & 5 deletions pyrate_limiter/clocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from typing import TYPE_CHECKING

from .abstracts import AbstractClock
from .exceptions import PyrateClockException
from .utils import dedicated_sqlite_clock_connection

if TYPE_CHECKING:
Expand Down Expand Up @@ -67,10 +66,7 @@ def now(self) -> int:
with conn.cursor() as cur:
cur.execute("SELECT EXTRACT(epoch FROM current_timestamp) * 1000")
result = cur.fetchone()

if not result:
raise PyrateClockException(self, detail=f"invalid result from query current-timestamp: {result}")

assert result, "unable to get current-timestamp from postgres"
value = int(result[0])

return value
6 changes: 0 additions & 6 deletions pyrate_limiter/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,3 @@ def __init__(self, item: RateItem, rate: Rate, actual_delay: int, max_delay: int
"actual_delay": actual_delay,
}
super().__init__(error)


class PyrateClockException(Exception):
def __init__(self, clock: object, detail=None):
error = f"Clock({repr(clock)}) is failing: {detail}"
super().__init__(error)

0 comments on commit 20fd688

Please sign in to comment.