Skip to content

Commit

Permalink
Make the parameter-less RedisClientError factory statics computed pro…
Browse files Browse the repository at this point in the history
…perties. 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.
  • Loading branch information
gwynne committed May 28, 2023
1 parent aa185a0 commit 8ac2d74
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/RediStack/RedisClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ extension RedisClient {
/// When working with `RedisClient`, runtime errors can be thrown to indicate problems with connection state, decoding assertions, or otherwise.
public struct RedisClientError: LocalizedError, Equatable, Hashable {
/// The connection is closed, but was used to try and send a command to Redis.
public static let connectionClosed = RedisClientError(.connectionClosed)
public static var connectionClosed: RedisClientError { .init(.connectionClosed) }
/// A race condition was triggered between unsubscribing from the last target while subscribing to a new target.
public static let subscriptionModeRaceCondition = RedisClientError(.subscriptionModeRaceCondition)
public static var subscriptionModeRaceCondition: RedisClientError { .init(.subscriptionModeRaceCondition) }
/// A connection that is not authorized for PubSub subscriptions attempted to create a subscription.
public static let pubsubNotAllowed = RedisClientError(.pubsubNotAllowed)
public static var pubsubNotAllowed: RedisClientError { .init(.pubsubNotAllowed) }

/// Conversion from `RESPValue` to the specified type failed.
///
Expand Down

0 comments on commit 8ac2d74

Please sign in to comment.