node.js - Passport session cookies in redis constantly keep getting created -
my express app uses passportjs storing auth session creates ridiculous number of keys in redis store , keys same:
"{\"cookie\":{\"originalmaxage\":null,\"expires\":null,\"httponly\":true,\"path\":\"/\"},\"passport\":{}}"
they have ttl store growing in size no reason. idea why these being created? keys looks like:
"sess:8r3a-k6darjvxxfdaxr5ntg7mec7jtxb" "sess:s4vyc-k-nmfsf7n-qgqjimfmt30eyndp" "sess:bs7wo92nyl5r0wabj-vo9o8w1apu0kp7" "sess:0b1aks6-mcclpvoxv0nlvnio8u8fxyqo" "sess:v0uwf60lmwkmmvzgo4rwumx313ypsid0"
if eyeball it, around 10 keys being created every second or two.
this how session code looks:
var express = require('express'), .... session = require('express-session'), redisstore = require('connect-redis')(session); ... app.use(express.static(path.resolve('./public'))); //redis var redisclient = redishelper.init(); app.use(session({ secret: '...', store: new redisstore({ client: redisclient, ttl: 86400 }), resave: false, saveuninitialized: false, cookie:{maxage:86400} })); //passport app.use(passport.initialize()); app.use(passport.session()); ...
redis init function returns instance of redis client:
exports.init = function () { redisclient = redis.createclient(config.redis.port, config.redis.server, {}); redisclient.auth(config.redis.auth); redisclient.on('error', function (error) { //todo: log error winston.error('error while talking redis', {message: error}); }); return redisclient; };
Comments
Post a Comment