Skip to content

Commit ca92534

Browse files
committed
Keep trucking on timeout
Do not fail to scan on timeout, instead keep on trucking and log errors. Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent 6252270 commit ca92534

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/scancode/cli.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
from collections import defaultdict
2323
from functools import partial
24+
from multiprocessing import TimeoutError
2425
from time import sleep
2526
from time import time
2627

@@ -65,6 +66,8 @@ class WindowsError(Exception):
6566
from scancode.interrupt import DEFAULT_TIMEOUT
6667
from scancode.interrupt import fake_interruptible
6768
from scancode.interrupt import interruptible
69+
from scancode.pool import ScanCodeTimeoutError
70+
6871

6972
# Tracing flags
7073
TRACE = False
@@ -1296,7 +1299,10 @@ def scan_codebase(
12961299
else:
12971300
setattr(resource, key, value)
12981301
codebase.save_resource(resource)
1299-
1302+
except (TimeoutError, ScanCodeTimeoutError):
1303+
codebase.errors.append("Timeout waiting for resource. Path unknown.")
1304+
success = False
1305+
continue
13001306
except StopIteration:
13011307
break
13021308
except KeyboardInterrupt:

0 commit comments

Comments
 (0)