-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Ensure that content is complete using a queue #5986
Conversation
Here's an example of your CHANGELOG entry: * Ensure that content is complete using a queue.
[SimplyDanny](https://github.com/SimplyDanny)
[#issue_number](https://github.com/realm/SwiftLint/issues/issue_number) note: There are two invisible spaces after the entry's text. Generated by 🚫 Danger |
I'm not 100% on what's going on here, but at least this is concerning: actor Console {
static var content = ""
} This is a mutable global without a lock. Placing it in an The test probably passes so long as tests don't execute concurrently, but when they do, all bets are off as to which test receives what output. Adopting Swift Testing will likely make the problem more visible? But I also don't think you need a queue to fix the problem; simply locking around access to It seems the project doesn't have an equivalent of |
49eee3e
to
838b953
Compare
I got rid of the global variable. My assumption was that the actor would protect it but should have noticed that the compiler didn't require The local variable that's now used would be isolated to The queue is needed to ensure all print operations to have finished before I experimented with Swift Testing. However, adopting it would mean excluding people who are still on Xcode <16. That's perhaps a bit too early. |
That's a good catch on the actor static. Those are known unsafe swiftlang/swift#78435 There might also be an issue with changing priority in that |
8bd06c1
to
39a1026
Compare
39a1026
to
a9c8e0c
Compare
Oh, that's great! |
The previous solution worked most of the time, but every now and then it failed due to laxly defined order.