Skip to content

Commit

Permalink
Bump cacheman TTL from 60 seconds to 1 hour (#210)
Browse files Browse the repository at this point in the history
## Why are we doing this?

While investigating losing selfies #193 , it doth appear that [Cacheman's default TTL is 60 seconds](https://github.com/cayasso/cacheman/blob/6149f436268cedbec54633c81481ae7035411873/lib/index.js#L99-L104) but [it's not documented](cayasso/cacheman#37). So it was dropping data. This raises it to match our definition of a user session, one hour.

## Did you document your work?

This explicitly sets the TTL, which increases documentations

## How can someone test these changes?

Steps to manually verify the change:

1. Using the `master` branch
1. I started a bot
2. talked to the bot, noting the `count` log
```
lenses:messenger message.text user:1250872178269050 text: "fart" count: 1 seq: 8760
```
3. wait over a minute and talk again, the `count` will go back to `1`.
5. do the same thing with this branch, but the `count` will keep going up.

## What possible risks or adverse effects are there?

I haven't looked into cacheman's internals, but this is effectively the same as a memory leak. We can transition to another backend if this is a problem. As it is, we're not using a lot of RAM.

## What are the follow-up tasks?

* watch #193 

## Are there any known issues?

none

## Did the test coverage decrease?

same, initial values to cacheman are not part of the test suite.
  • Loading branch information
crccheck authored Jan 24, 2017
1 parent 93312d4 commit 6b67485
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const reqPromise = require('request-promise');
const urlJoin = require('url-join');
const conversationLogger = require('./conversationLogger');

const cache = new Cacheman('sessions');

const SESSION_TIMEOUT_MS = 3600 * 1000; // 1 hour

const cache = new Cacheman('sessions', {ttl: SESSION_TIMEOUT_MS / 1000});

const internals = {};


Expand Down

0 comments on commit 6b67485

Please sign in to comment.