From c1516f0b412011817150e261f848027b74db4908 Mon Sep 17 00:00:00 2001 From: Brandur Date: Wed, 3 Jul 2024 17:57:50 -0700 Subject: [PATCH] Remove time stub from client The client has a time stub with a comment indicating it's for time stubbing, but the test suite stubs time out in more traditional ways, so I believe this is an artifact of something that was intended to be used, but was not. --- src/riverqueue/client.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/riverqueue/client.py b/src/riverqueue/client.py index 1903e6b..37697ac 100644 --- a/src/riverqueue/client.py +++ b/src/riverqueue/client.py @@ -48,7 +48,6 @@ class Client: def __init__(self, driver: DriverProtocol, advisory_lock_prefix=None): self.driver = driver self.advisory_lock_prefix = advisory_lock_prefix - self.time_now_utc = lambda: datetime.now(timezone.utc) # for test time stubbing def insert( self, args: Args, insert_opts: Optional[InsertOpts] = None @@ -123,7 +122,7 @@ def __check_unique_job( if unique_opts.by_period: lower_period_bound = self.__truncate_time( - self.time_now_utc(), unique_opts.by_period + datetime.now(timezone.utc), unique_opts.by_period ) any_unique_opts = True