Skip to content
Browse files

call sessionModel.validate at intervals

  • Loading branch information...
1 parent 617909c commit ec409b0cb55a6e25092ce16f8df09f431b2a0daf @neonstalwart neonstalwart committed
Showing with 4 additions and 2 deletions.
  1. +4 −2 jsgi/session.js
View
6 jsgi/session.js
@@ -20,9 +20,11 @@ exports.Session = function(options, nextApp){
if (!options.expires) options.expires = -(settings.sessionTTL || 300);
// start the reaper
// TODO: get a timer for narwhal
- if (typeof exports.getSessionModel().validate === 'function' && typeof setTimeout !== "undefined") setTimeout(function(){
+ function validate() {
exports.getSessionModel().validate();
- }, options.expires*1000);
+ setTimeout(validate, options.expires * 1000);
+ }
+ if (typeof exports.getSessionModel().validate === 'function' && typeof setTimeout !== "undefined") validate();
//
return function(request){
var session;

0 comments on commit ec409b0

Please sign in to comment.
Something went wrong with that request. Please try again.