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

Expand --serialParse flag to also apply to Composer.uniqueTypesAndFunctions #1301

Merged

Conversation

calda
Copy link
Contributor

@calda calda commented Mar 13, 2024

This PR expands the --serialParse flag to also apply to Composer.uniqueTypesAndFunctions, so it also performs work serially instead of concurrently.

This is a follow-up to #1063.

Eric posted that PR to work around a concurrency-related crash we hit in Sourcery when running it on Airbnb's app codebase. Since then, we've internally been using a custom build of Sourcery with that change plus an additional change that updates Composer.uniqueTypesAndFunctions to also be serial. I've confirmed that we still occasionally see concurrency-related crashes without that additional change.

The --serialParse flag was introduced as a way to work around concurrency-related crashes. Since it is possible to hit concurrency-related crashes in Composer.uniqueTypesAndFunctions, it seems reasonable to expand the --serialParse option to also disable concurrency within that method. This resolves the crashes we hit internally when trying to adopt Sourcery 2.1.7.

@art-divin art-divin self-requested a review March 13, 2024 19:52
@art-divin art-divin added this to the 2.1.8 milestone Mar 13, 2024
@@ -48,7 +48,7 @@ public final class TemplateContext: NSObject, SourceryModel, NSCoding, Diffable
let fileParserResultCopy: FileParserResult? = nil
// fileParserResultCopy = try? NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(NSKeyedArchiver.archivedData(withRootObject: parserResult)) as? FileParserResult

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to put a comment here for future reference, that SwiftSyntax may misbehave when used from background threads (see a relevant comment here), thus false is hardcoded.

Copy link
Collaborator

@art-divin art-divin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work @calda ❤️

@art-divin art-divin merged commit df53fed into krzysztofzablocki:master Mar 13, 2024
2 checks passed
@calda
Copy link
Contributor Author

calda commented Mar 13, 2024

Thanks for the spppeeeeeeedddyyy review @art-divin 🙇🏻

@art-divin
Copy link
Collaborator

@calda wanna see the real speed 🏎️ - checkout actions tab 🤓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants