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 1
1
Changelog
2
2
=========
3
3
4
+ v3.5.1 (2022-02-16)
5
+ -------------------
6
+ - Use ``time.monotonic `` instead of ``time.time `` for calculating timeouts.
7
+
4
8
v3.5.0 (2022-02-15)
5
9
-------------------
6
10
- Enable use as context decorator
Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ def acquire(
161
161
162
162
lock_id = id (self )
163
163
lock_filename = self ._lock_file
164
- start_time = time .time ()
164
+ start_time = time .monotonic ()
165
165
try :
166
166
while True :
167
167
with self ._thread_lock :
@@ -172,7 +172,7 @@ def acquire(
172
172
if self .is_locked :
173
173
_LOGGER .debug ("Lock %s acquired on %s" , lock_id , lock_filename )
174
174
break
175
- elif 0 <= timeout < time .time () - start_time :
175
+ elif 0 <= timeout < time .monotonic () - start_time :
176
176
_LOGGER .debug ("Timeout on acquiring lock %s on %s" , lock_id , lock_filename )
177
177
raise Timeout (self ._lock_file )
178
178
else :
You can’t perform that action at this time.
0 commit comments