File tree Expand file tree Collapse file tree
@app/server/src/middleware Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,7 +23,15 @@ const MAXIMUM_SESSION_DURATION_IN_MILLISECONDS =
2323 parseInt ( process . env . MAXIMUM_SESSION_DURATION_IN_MILLISECONDS || "" , 10 ) ||
2424 3 * DAY ;
2525
26- export default ( app : Express ) => {
26+ async function createRedisStore ( ) {
27+ const client = redis . createClient ( {
28+ url : process . env . REDIS_URL ,
29+ } ) ;
30+ await client . connect ( ) ;
31+ return new RedisStore ( { client } ) ;
32+ }
33+
34+ export default async ( app : Express ) => {
2735 const rootPgPool = getRootPgPool ( app ) ;
2836
2937 const store = process . env . REDIS_URL
@@ -33,11 +41,7 @@ export default (app: Express) => {
3341 *
3442 * https://medium.com/mtholla/managing-node-js-express-sessions-with-redis-94cd099d6f2f
3543 */
36- new RedisStore ( {
37- client : redis . createClient ( {
38- url : process . env . REDIS_URL ,
39- } ) ,
40- } )
44+ await createRedisStore ( )
4145 : /*
4246 * Using PostgreSQL for session storage is easy to set up, but increases
4347 * the load on your database. We recommend that you graduate to using
You can’t perform that action at this time.
0 commit comments