Allow custom timeout for db locking
This commit is contained in:
parent
9272b3f8e3
commit
93458c4782
|
@ -3,9 +3,9 @@ import json
|
||||||
import pathlib
|
import pathlib
|
||||||
import time
|
import time
|
||||||
|
|
||||||
def lock(name):
|
def lock(name, timeout=5):
|
||||||
lockfile = pathlib.Path.home() / f'{name}.lock'
|
lockfile = pathlib.Path.home() / f'{name}.lock'
|
||||||
for i in range(5):
|
for i in range(timeout):
|
||||||
try:
|
try:
|
||||||
lockfile.symlink_to('/dev/null')
|
lockfile.symlink_to('/dev/null')
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue