Skip to content

Commit 3bd5940

Browse files
committed
Make the parameter-less RedisClientError factory statics computed properties. As stored properties, they trigger Thread Sanitizer errors when multiple connections trigger the same errors (usually connectionClosed) too close together due to lazy once-only initialization.
1 parent 254e3e7 commit 3bd5940

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/RediStack/RedisClient.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ extension RedisClient {
246246
/// When working with `RedisClient`, runtime errors can be thrown to indicate problems with connection state, decoding assertions, or otherwise.
247247
public struct RedisClientError: LocalizedError, Equatable, Hashable {
248248
/// The connection is closed, but was used to try and send a command to Redis.
249-
public static let connectionClosed = RedisClientError(.connectionClosed)
249+
public static var connectionClosed: RedisClientError { .init(.connectionClosed) }
250250
/// A race condition was triggered between unsubscribing from the last target while subscribing to a new target.
251-
public static let subscriptionModeRaceCondition = RedisClientError(.subscriptionModeRaceCondition)
251+
public static var subscriptionModeRaceCondition: RedisClientError { .init(.subscriptionModeRaceCondition) }
252252
/// A connection that is not authorized for PubSub subscriptions attempted to create a subscription.
253-
public static let pubsubNotAllowed = RedisClientError(.pubsubNotAllowed)
253+
public static var pubsubNotAllowed: RedisClientError { .init(.pubsubNotAllowed) }
254254

255255
/// Conversion from `RESPValue` to the specified type failed.
256256
///

0 commit comments

Comments
 (0)