Skip to content

Commit f2f927f

Browse files
feat: Enables strict concurrency
1 parent 288e017 commit f2f927f

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ let package = Package(
2727
name: "GraphQLWSTests",
2828
dependencies: ["GraphQLWS"]
2929
),
30-
]
30+
],
31+
swiftLanguageVersions: [.v5, .version("6")]
3132
)

Sources/GraphQLWS/GraphQLWSError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ struct GraphQLWSError: Error {
8888
}
8989

9090
/// Error codes for miscellaneous issues
91-
public enum ErrorCode: Int, CustomStringConvertible {
91+
public enum ErrorCode: Int, CustomStringConvertible, Sendable {
9292
// Miscellaneous
9393
case miscellaneous = 4400
9494

Sources/GraphQLWS/Server.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import GraphQL
44
/// Server implements the server-side portion of the protocol, allowing a few callbacks for customization.
55
///
66
/// By default, there are no authorization checks
7-
public class Server<InitPayload: Equatable & Codable> {
7+
public class Server<InitPayload: Equatable & Codable>: @unchecked Sendable {
88
// We keep this weak because we strongly inject this object into the messenger callback
99
weak var messenger: Messenger?
1010

Tests/GraphQLWSTests/Utils/TestAPI.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct TestAPI: API {
1616
}
1717
}
1818

19-
final class TestContext {
19+
final class TestContext: Sendable {
2020
let publisher = SimplePubSub<String>()
2121

2222
func hello() -> String {
@@ -35,7 +35,7 @@ struct TestResolver {
3535
}
3636

3737
/// A very simple publish/subscriber used for testing
38-
class SimplePubSub<T> {
38+
class SimplePubSub<T: Sendable>: @unchecked Sendable {
3939
private var subscribers: [Subscriber<T>]
4040

4141
init() {

Tests/GraphQLWSTests/Utils/TestMessenger.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import Foundation
77
///
88
/// Note that this only retains a weak reference to 'other', so the client should retain references
99
/// or risk them being deinitialized early
10-
class TestMessenger: Messenger {
10+
class TestMessenger: Messenger, @unchecked Sendable {
1111
weak var other: TestMessenger?
1212
var onReceive: (String) async throws -> Void = { _ in }
1313
let queue: DispatchQueue = .init(label: "Test messenger")
1414

1515
init() {}
1616

17-
func send<S>(_ message: S) async throws where S: Collection, S.Element == Character {
17+
func send<S: Sendable>(_ message: S) async throws where S: Collection, S.Element == Character {
1818
guard let other = other else {
1919
return
2020
}

0 commit comments

Comments
 (0)