File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1351,16 +1351,22 @@ def cache_lock(self, url):
1351
1351
1352
1352
lock_dir = os .path .join (cpath , '.lock' )
1353
1353
lock_file = os .path .join (lock_dir , 'pid' )
1354
+ timeout = 300
1354
1355
1355
- for i in range (300 ):
1356
+ for i in range (timeout ):
1356
1357
if i :
1357
1358
time .sleep (1 )
1358
1359
1359
1360
if os .path .exists (lock_dir ):
1360
1361
if os .path .isfile (lock_file ):
1361
1362
with open (lock_file , 'r' , 0 ) as f :
1362
- pid = int (f .read (8 ))
1363
- if pid != os .getpid () and self .pid_exists (pid ):
1363
+ pid = f .read (8 )
1364
+ if not pid :
1365
+ if int (os .path .getmtime (lock_file )) + timeout < int (time .time ()):
1366
+ info ("Cache lock file exists, but is empty. Cleaning up" )
1367
+ os .remove (lock_file )
1368
+ os .rmdir (lock_dir )
1369
+ elif int (pid ) != os .getpid () and self .pid_exists (pid ):
1364
1370
info ("Cache lock file exists and process %s is alive." % pid )
1365
1371
else :
1366
1372
info ("Cache lock file exists, but %s is dead. Cleaning up" % pid )
You can’t perform that action at this time.
0 commit comments