Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.20.1] Parallelize background file scan #86

Merged
merged 3 commits into from
Feb 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ public ModFileScanData scan() {
if (loaders != null) {
loaders.forEach(loader -> {
LOGGER.debug(LogMarkers.SCAN, "Scanning {} with language loader {}", fileToScan.getFilePath(), loader.name());
loader.getFileVisitor().accept(result);
// Since we now scan files concurrently, but language loaders may not have been written with that in mind,
// synchronize on the language loader so it only scans one file at a time
synchronized (loader) {
Technici4n marked this conversation as resolved.
Show resolved Hide resolved
loader.getFileVisitor().accept(result);
}
});
}
return result;
Expand Down
Loading