Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected Behavior - Expired sessions in the CouchDB Store #20

Open
d1b1 opened this issue Aug 23, 2012 · 4 comments
Open

Expected Behavior - Expired sessions in the CouchDB Store #20

d1b1 opened this issue Aug 23, 2012 · 4 comments

Comments

@d1b1
Copy link

d1b1 commented Aug 23, 2012

Morning killer module, two issues/questions. First I found that the Connect-CouchDB store fails with older version of Express. The last three verisons of express 3.0.0rc1 - 3 appears to solve a session bug. Is this a known issue? For newbies, this might be helpful to document.

Second, can you clarify the how a session store will retire or clear our expired sessions? Does the dev need to write a function that will query the expired session view and purge documents?

Thanks, once we got the version/cookie issue solved with express, this module helped us move our app to multi-server EC setup.

@pdelanauze
Copy link

Interested in this as well ...

@d1b1
Copy link
Author

d1b1 commented Sep 9, 2012

One thing worth noting, is the version of express makes a big dffference. We had to upgrade to v3.0.0rc1+. It appears early express versions did not handle session cookie detection well. We found that session did not persiste and generated a new couchdb session document for each request. With the upgrade session works perfectly. We are looking at how to configure a clean up process.

@qraynaud
Copy link

There seem to be a bug in the way the code that is already in the module works. I'm working on a fix for this and hope to propose it soon.

@qraynaud
Copy link

Well, I just looked into the code and in fact it seems correct though it could be a lot simpler. The real problem is that by default session expires after 24h and that there is no visible option to tweak this value globally. You can set in each session the cookie.maxAge value to adapt this behaviour (in ms). For exemple, at each request, set req.session.cookie.maxAge to 30 * 60 * 1000 to keep sessions 30 minutes.

Keep in mind to have a reapInterval option value in line with your maxAge. if you set a maxAge of 10 minutes, then keeping the default reapInterval of 10 minutes will obviously lead to more time for deletion in a lot of cases (the cookie might stay 20 minutes at the worst). So be careful about what your requirements are on this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants