diff --git a/src/Database/Redis/Connection.hs b/src/Database/Redis/Connection.hs index 156662ec..d68b791e 100644 --- a/src/Database/Redis/Connection.hs +++ b/src/Database/Redis/Connection.hs @@ -227,13 +227,15 @@ connectCluster bootstrapConnInfo = do shardMap <- shardMapFromClusterSlotsResponse slots newMVar shardMap commandInfos <- runRedisInternal conn command + let timeoutOptUs = + round . (1000000 *) <$> connectTimeout bootstrapConnInfo case commandInfos of Left e -> throwIO $ ClusterConnectError e Right infos -> do #if MIN_VERSION_resource_pool(0,3,0) - pool <- newPool (defaultPoolConfig (Cluster.connect infos shardMapVar Nothing) Cluster.disconnect (realToFrac $ connectMaxIdleTime bootstrapConnInfo) (connectMaxConnections bootstrapConnInfo)) + pool <- newPool (defaultPoolConfig (Cluster.connect infos shardMapVar timeoutOptUs) Cluster.disconnect (realToFrac $ connectMaxIdleTime bootstrapConnInfo) (connectMaxConnections bootstrapConnInfo)) #else - pool <- createPool (Cluster.connect infos shardMapVar Nothing) Cluster.disconnect 1 (connectMaxIdleTime bootstrapConnInfo) (connectMaxConnections bootstrapConnInfo) + pool <- createPool (Cluster.connect infos shardMapVar timeoutOptUs) Cluster.disconnect 1 (connectMaxIdleTime bootstrapConnInfo) (connectMaxConnections bootstrapConnInfo) #endif return $ ClusteredConnection shardMapVar pool