File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 11Changelog
22=========
33
4+ v3.5.1 (2022-02-16)
5+ -------------------
6+ - Use ``time.monotonic `` instead of ``time.time `` for calculating timeouts.
7+
48v3.5.0 (2022-02-15)
59-------------------
610- Enable use as context decorator
Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ def acquire(
161161
162162 lock_id = id (self )
163163 lock_filename = self ._lock_file
164- start_time = time .time ()
164+ start_time = time .monotonic ()
165165 try :
166166 while True :
167167 with self ._thread_lock :
@@ -172,7 +172,7 @@ def acquire(
172172 if self .is_locked :
173173 _LOGGER .debug ("Lock %s acquired on %s" , lock_id , lock_filename )
174174 break
175- elif 0 <= timeout < time .time () - start_time :
175+ elif 0 <= timeout < time .monotonic () - start_time :
176176 _LOGGER .debug ("Timeout on acquiring lock %s on %s" , lock_id , lock_filename )
177177 raise Timeout (self ._lock_file )
178178 else :
You can’t perform that action at this time.
0 commit comments