reswifq / redis-client-vapor

Adapter to use vapor/redis with reswifq.
GNU Lesser General Public License v3.0
1 stars 1 forks source link

How to use this with Redis Connection pool? #3

Closed lephyrius closed 6 years ago

lephyrius commented 6 years ago

How do I use it with Redis client pool?

let client = RedisClientPool(maxElementCount: 10 , factory: { () -> RedisClient in
                let tcpClient = try TCPClient(hostname: redisHost, port: UInt16(redisPort)!) // <- This can throw.
                return VaporRedisClient(tcpClient)   // <- This cannot return an optional.
            })

So how do I create a new VaporRedisClient that always succeeds?

valeriomazzeo commented 6 years ago

Hi @lephyrius thanks for the report.

This looks like an oversight on https://github.com/reswifq/pool/blob/master/Sources/Pool/Pool.swift

The factory method should probably be throwing.

valeriomazzeo commented 6 years ago

this is now fixed by https://github.com/reswifq/pool/commit/3b3ad5f98542ed42abe4bbea035591357519e5c5