Skip to content

Commit 5b4b777

Browse files
authored
Better timeout detection in dartdoc_runner. (#4359)
* Better timeout detection in dartdoc_runner. * Don't log warning if timeout happened.
1 parent 6390a0a commit 5b4b777

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

app/lib/dartdoc/dartdoc_runner.dart

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -387,28 +387,33 @@ class DartdocJobProcessor extends JobProcessor {
387387
);
388388
final hasIndexHtml = await File(p.join(outputDir, 'index.html')).exists();
389389
final hasIndexJson = await File(p.join(outputDir, 'index.json')).exists();
390-
return DartdocResult(pr, pr.exitCode == 15, hasIndexHtml, hasIndexJson);
390+
final stdoutStr = pr.stdout.toString();
391+
return DartdocResult(
392+
pr,
393+
pr.exitCode == 15 ||
394+
pr.exitCode == -9 ||
395+
(pr.exitCode != 0 && stdoutStr.contains('timeout')),
396+
hasIndexHtml,
397+
hasIndexJson,
398+
);
391399
}
392400

393401
final sw = Stopwatch()..start();
394402
DartdocResult r = await runDartdoc();
395403
sw.stop();
396404
logger.info('Running dartdoc for ${job.packageName} ${job.packageVersion} '
397405
'completed in ${sw.elapsed}.');
398-
final shouldRetry = r.wasTimeout ||
399-
// TODO: remove this after https://github.com/dart-lang/dartdoc/issues/2101 gets fixed
400-
(!r.wasSuccessful &&
401-
r.processResult.stdout.toString().contains(
402-
"type 'FunctionTypeImpl' is not a subtype of type 'InterfaceType'"));
403-
if (shouldRetry) {
406+
if (r.wasTimeout) {
404407
r = await runDartdoc(isReduced: true);
405408
}
406409

407410
_appendLog(logFileOutput, r.processResult);
408411
final hasContent = r.hasIndexHtml && r.hasIndexJson;
409412

410413
if (r.processResult.exitCode != 0) {
411-
if (hasContent || _isKnownFailurePattern(_mergeOutput(r.processResult))) {
414+
if (hasContent ||
415+
r.wasTimeout ||
416+
_isKnownFailurePattern(_mergeOutput(r.processResult))) {
412417
logger.info('Error while running dartdoc for $job (see log.txt).');
413418
} else {
414419
final output = _mergeOutput(r.processResult, compressStdout: true);

0 commit comments

Comments
 (0)