File tree Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -1358,23 +1358,26 @@ def cache_lock(self, url):
1358
1358
time .sleep (1 )
1359
1359
1360
1360
if os .path .exists (lock_dir ):
1361
- if os .path .isfile (lock_file ):
1362
- with open (lock_file , 'r' , 0 ) as f :
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" )
1361
+ try :
1362
+ if os .path .isfile (lock_file ):
1363
+ with open (lock_file , 'r' , 0 ) as f :
1364
+ pid = f .read (8 )
1365
+ if not pid :
1366
+ if int (os .path .getmtime (lock_file )) + timeout < int (time .time ()):
1367
+ info ("Cache lock file exists, but is empty. Cleaning up" )
1368
+ os .remove (lock_file )
1369
+ os .rmdir (lock_dir )
1370
+ elif int (pid ) != os .getpid () and self .pid_exists (pid ):
1371
+ info ("Cache lock file exists and process %s is alive." % pid )
1372
+ else :
1373
+ info ("Cache lock file exists, but %s is dead. Cleaning up" % pid )
1367
1374
os .remove (lock_file )
1368
1375
os .rmdir (lock_dir )
1369
- elif int (pid ) != os .getpid () and self .pid_exists (pid ):
1370
- info ("Cache lock file exists and process %s is alive." % pid )
1371
1376
else :
1372
- info ("Cache lock file exists, but %s is dead. Cleaning up" % pid )
1373
- os .remove (lock_file )
1374
1377
os .rmdir (lock_dir )
1375
- else :
1376
- os . rmdir ( lock_dir )
1377
- continue
1378
+ continue
1379
+ except ( OSError ) as e :
1380
+ continue
1378
1381
else :
1379
1382
try :
1380
1383
os .mkdir (lock_dir )
You can’t perform that action at this time.
0 commit comments