Skip to content

Commit 8ac2d74

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 aa185a0 commit 8ac2d74

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: Sources/RediStack/RedisClient.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ extension RedisClient {
237237
/// When working with `RedisClient`, runtime errors can be thrown to indicate problems with connection state, decoding assertions, or otherwise.
238238
public struct RedisClientError: LocalizedError, Equatable, Hashable {
239239
/// The connection is closed, but was used to try and send a command to Redis.
240-
public static let connectionClosed = RedisClientError(.connectionClosed)
240+
public static var connectionClosed: RedisClientError { .init(.connectionClosed) }
241241
/// A race condition was triggered between unsubscribing from the last target while subscribing to a new target.
242-
public static let subscriptionModeRaceCondition = RedisClientError(.subscriptionModeRaceCondition)
242+
public static var subscriptionModeRaceCondition: RedisClientError { .init(.subscriptionModeRaceCondition) }
243243
/// A connection that is not authorized for PubSub subscriptions attempted to create a subscription.
244-
public static let pubsubNotAllowed = RedisClientError(.pubsubNotAllowed)
244+
public static var pubsubNotAllowed: RedisClientError { .init(.pubsubNotAllowed) }
245245

246246
/// Conversion from `RESPValue` to the specified type failed.
247247
///

0 commit comments

Comments
 (0)