Skip to content
This repository
Browse code

call sessionModel.validate at intervals

  • Loading branch information...
commit ec409b0cb55a6e25092ce16f8df09f431b2a0daf 1 parent 617909c
Ben Hockey neonstalwart authored

Showing 1 changed file with 4 additions and 2 deletions. Show diff stats Hide diff stats

  1. +4 2 jsgi/session.js
6 jsgi/session.js
@@ -20,9 +20,11 @@ exports.Session = function(options, nextApp){
20 20 if (!options.expires) options.expires = -(settings.sessionTTL || 300);
21 21 // start the reaper
22 22 // TODO: get a timer for narwhal
23   - if (typeof exports.getSessionModel().validate === 'function' && typeof setTimeout !== "undefined") setTimeout(function(){
  23 + function validate() {
24 24 exports.getSessionModel().validate();
25   - }, options.expires*1000);
  25 + setTimeout(validate, options.expires * 1000);
  26 + }
  27 + if (typeof exports.getSessionModel().validate === 'function' && typeof setTimeout !== "undefined") validate();
26 28 //
27 29 return function(request){
28 30 var session;

0 comments on commit ec409b0

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