Save last lock time
This commit is contained in:
parent
845b50915d
commit
7af8d1cd93
1 changed files with 2 additions and 0 deletions
|
@ -72,8 +72,10 @@ class Lock:
|
||||||
self.lock = gevent._threading.Lock()
|
self.lock = gevent._threading.Lock()
|
||||||
self.locked = self.lock.locked
|
self.locked = self.lock.locked
|
||||||
self.release = self.lock.release
|
self.release = self.lock.release
|
||||||
|
self.time_lock = 0
|
||||||
|
|
||||||
def acquire(self, *args, **kwargs):
|
def acquire(self, *args, **kwargs):
|
||||||
|
self.time_lock = time.time()
|
||||||
if self.locked() and isMainThread():
|
if self.locked() and isMainThread():
|
||||||
# Start in new thread to avoid blocking gevent loop
|
# Start in new thread to avoid blocking gevent loop
|
||||||
return lock_pool.apply(self.lock.acquire, args, kwargs)
|
return lock_pool.apply(self.lock.acquire, args, kwargs)
|
||||||
|
|
Loading…
Reference in a new issue