Build log sections in series.
Doing them in parallel was causing possible bad blocked thread reports, since the thread section could be built at the same time we were building the jobs section.
This commit is contained in:
parent
5e58f0a212
commit
9fb85f7c76
1 changed files with 10 additions and 24 deletions
|
@ -22,9 +22,7 @@ import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Future;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
|
@ -59,10 +57,10 @@ public class SubmitDebugLogRepository {
|
||||||
add(new LogSectionPower());
|
add(new LogSectionPower());
|
||||||
}
|
}
|
||||||
add(new LogSectionPin());
|
add(new LogSectionPin());
|
||||||
add(new LogSectionThreads());
|
|
||||||
add(new LogSectionCapabilities());
|
add(new LogSectionCapabilities());
|
||||||
add(new LogSectionFeatureFlags());
|
add(new LogSectionFeatureFlags());
|
||||||
add(new LogSectionPermissions());
|
add(new LogSectionPermissions());
|
||||||
|
add(new LogSectionThreads());
|
||||||
add(new LogSectionLogcat());
|
add(new LogSectionLogcat());
|
||||||
add(new LogSectionLogger());
|
add(new LogSectionLogger());
|
||||||
}};
|
}};
|
||||||
|
@ -134,10 +132,9 @@ public class SubmitDebugLogRepository {
|
||||||
|
|
||||||
int maxTitleLength = Stream.of(SECTIONS).reduce(0, (max, section) -> Math.max(max, section.getTitle().length()));
|
int maxTitleLength = Stream.of(SECTIONS).reduce(0, (max, section) -> Math.max(max, section.getTitle().length()));
|
||||||
|
|
||||||
List<Future<List<LogLine>>> futures = new ArrayList<>();
|
List<LogLine> allLines = new ArrayList<>();
|
||||||
|
|
||||||
for (LogSection section : SECTIONS) {
|
for (LogSection section : SECTIONS) {
|
||||||
futures.add(SignalExecutors.BOUNDED.submit(() -> {
|
|
||||||
List<LogLine> lines = getLinesForSection(context, section, maxTitleLength);
|
List<LogLine> lines = getLinesForSection(context, section, maxTitleLength);
|
||||||
|
|
||||||
if (SECTIONS.indexOf(section) != SECTIONS.size() - 1) {
|
if (SECTIONS.indexOf(section) != SECTIONS.size() - 1) {
|
||||||
|
@ -146,18 +143,7 @@ public class SubmitDebugLogRepository {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return lines;
|
allLines.addAll(lines);
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<LogLine> allLines = new ArrayList<>();
|
|
||||||
|
|
||||||
for (Future<List<LogLine>> future : futures) {
|
|
||||||
try {
|
|
||||||
allLines.addAll(future.get());
|
|
||||||
} catch (ExecutionException | InterruptedException e) {
|
|
||||||
throw new AssertionError(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<LogLine> withIds = new ArrayList<>(allLines.size());
|
List<LogLine> withIds = new ArrayList<>(allLines.size());
|
||||||
|
|
Loading…
Add table
Reference in a new issue