Change the build system to only notify delegate about changed files, not about new build settings

This defines away an entire class of data races if delegate callbacks are delivered out-of-order. If we aren’t providing the new build settings in the delegate callback, then it doesn’t matter if two `fileBuildSettingsChanged` calls change order since they don’t carry any state.
This commit is contained in:
Alex Hoppen
2023-09-29 21:59:59 -07:00
parent 93dfc3dfbf
commit dffcc939f7
13 changed files with 59 additions and 104 deletions

View File

@@ -202,11 +202,7 @@ public actor BuildServerBuildSystem: MessageHandler {
/// about the changed build settings.
private func buildSettingsChanged(for document: DocumentURI, settings: FileBuildSettings?) async {
buildSettings[document] = settings
if let settings {
await self.delegate?.fileBuildSettingsChanged([document: .modified(settings)])
} else {
await self.delegate?.fileBuildSettingsChanged([document: .removedOrUnavailable])
}
await self.delegate?.fileBuildSettingsChanged([document])
}
}