Tags: swift-server/RediStack
Tags
[Docs] Update README to use emoji instead of markdown for docsgen
Change RedisConnection to end subscriptions when not allowed Motivation: When `RedisConnection.allowSubscriptions` is set to `false`, the connection could still be in a subscription state leaving further commands to fail slowly from a full roundtrip to Redis, rather than succeeding as expected. This changes the implementation so that it triggers a full unsubscribe from patterns and channels when set to `false`. Modifications: - Change: `RedisConnection.allowSubscriptions` to call `unsubscribe()` and `punsubscribe()` when set to `false` - Change: `RedisPubSubHandler` to prefix storage of all dictionary keys to avoid name clashes between pattern and channel subscriptions Result: Developers should now have more deterministic and unsurprising behavior with PubSub in regards to subscription management and connection state.
Add default buffer connectionRetryTimeout to avoid literal immediate … …timeouts Motivation: When trying to allow users to configure the connection retry timeout offset, not having a value provided (deadline of `now`) caused all attempts to use the pool to fail. Modifications: - Change: RedisConnectionPool to always have a timeout offset defined Result: If users don't specify any value, then the default of 60 seconds will be used. If users specify "nil" (or `.none`) as the timeout, then a minimum of 10 milliseconds will be used to avoid immediate timeouts Otherwise, use the user's specified `TimeAmount` as the offset of the timeout
Add configuration option for RedisConnectionPool lease timeout Motivation: With RedisConnectionPool a timeout is provided to prevent infinite loops of retrying connections, but right now it is hardcoded to 60 seconds. Users of downstream projects such as Vapor are noticing a "regression" of sorts, as previously EventLoopFutures would fail immediately if a connection was not made available. Modifications: - Add: `connectionRetryTimeout` parameter to `RedisConnectionPool` initializer that still defaults to 60 seconds - Change: RedisConnectionPool to use the new parameter if available to offset a deadline from "now" Result: Users can now configure the connection pool to fail immediately if connections are not available.
Add support for PubSub Motivation: One of the great features of Redis is being able to subscribe and receive messages published to specific channels as a way of acting as a message queue for processing jobs. PubSub requires a specific understanding of the connection model that can only be implemented directly in this library. Modifications: - Add: `RedisPubSubHandler` to sit in front of `RedisCommandHandler` to manage subscription callbacks and Redis registration - Add: `publish` and the `pubsub` commands - Add: `addPubSubHandler` extension to `NIO.Channel` - Add: Type-safe String wrapper of `RedisChannelName` for PubSub methods - Add: `pubsubSubscriptionNotFound` error case - Add: `isSubscribed` property to `RedisConnection` - Add: `availableConnectionCount` and `leasedConnectionCount` properties to `RedisConnectionPool` - Add: Metrics for PubSub - Add: `makeNewPool` factory method to `RedisConnectionPoolIntegrationTestCase` - Change: `RedisClient` to require methods for PubSub management, as they are intrinsicly tied to the client's connection model - Change: Parsing of `PING` response for handling special case in PubSub mode - Rename: `ActiveConnectionGauge` to `RedisMetrics.IncrementalGauge` Result: Developers will now be able to use Redis in PubSub mode with both connections and pools. This resolves #6