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

Ability to turn off the sweeper #16

Merged
merged 3 commits into from
Jun 3, 2013
Merged

Conversation

luccastera
Copy link
Contributor

I've found that the sweeper was misbehaving and making a lot of mongodb requests. It looks like it was stuck in an infinite loop.

I also realized that some people might not want to have the sweeper running (in my case for example).

So I've added a way to turn off the sweeper by passing a sweeper: false option. The sweeper bug is not fixed by this pull request. The option to bypass it is all i need because I want to expire my sessions separately.

The following graph shows the drop in mongodb requests in a sample application after turning off the sweeper.

screen shot 2013-06-03 at 2 13 18 pm

@pronebird
Copy link
Collaborator

Can you show your config for session-mongoose and for cookies?

@luccastera
Copy link
Contributor Author

Before, when I had the problem with the sweeper, my config was:

{ url: dbURL, interval: 31536000000 }

After my change, my new config looks like:

{url: dbURL, sweeper: false}

@pronebird
Copy link
Collaborator

I experienced similar when I forgot to setup cookies maxAge. Could you please check your cookies' settings?

app.use(express.session({
  secret: "secret123",
  cookie: { 
    maxAge: 3.6e+6 * 10, // 10 hours
    httpOnly: false,
    path: '/'
  },
  store: new sessionMongoose({
    interval: 4.32e+6, // 1.2 hours
    connection: mongoose.connection
  })
}));

donpark added a commit that referenced this pull request Jun 3, 2013
Ability to turn off the sweeper
@donpark donpark merged commit 2d86c85 into donpark:master Jun 3, 2013
@donpark
Copy link
Owner

donpark commented Jun 3, 2013

Merged cause, possible configuration aside, this change won't hurt nor complicate the code much. Thanks @dambalah

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

Successfully merging this pull request may close these issues.

3 participants