Ch Zeeshan Ch Zeeshan - 1 month ago 14
Ruby Question

Issues with redis-rails and connection_pool

How I can initialize my redis_store to have connection pooling. I want to add pooling attributes { pool_size: 10, pool_timeout: 10 } I have added connection_pool gem

Example::Application.config.session_store :redis_store,
servers: { host: 'localhost',
port: 6379,
db: 0,
namespace: 'session'
},
expires_in: 25.hours,


It gives error on server boot. If I add something like below;

Example::Application.config.session_store :redis_store,
servers: { host: 'localhost',
port: 6379,
db: 0,
namespace: 'session'
},
expires_in: 25.hours,
{ pool_size: 10, pool_timeout: 10 }

Answer Source

After I'd executed your code, I've run into a simple SyntaxError. Might be your problem, since the correct specifying of the options should be:

Example::Application.config.session_store :redis_store,
                                      servers: { host:      'localhost',
                                                 port:      6379,
                                                 db:        0,
                                                 namespace: 'session'
                                      },
                                      expires_in: 25.hours,
                                      pool_size: 10,
                                      pool_timeout: 10