Skip to content

Commit

Permalink
Fix session timeouts (#40)
Browse files Browse the repository at this point in the history
## Why are we doing this?

This is a copy paste of a fix that wasn't copy pasted into the initial SDK. Cacheman has a default TTL of [60 seconds](https://github.com/cayasso/cacheman/blob/6149f436268cedbec54633c81481ae7035411873/lib/index.js#L99-L104) but [it's not documented](cayasso/cacheman#37). This meant if you took a break in the middle of a quiz, it would freeze on you.

## Did you document your work?

This explicitly sets the TTL, which increases documentation

## How can someone test these changes?

Can't test within the SDK, but this is a copy paste

## What possible risks or adverse effects are there?

* Uptime
* Security
* Performance degradation
* Data loss

If applicable, include a technical debt note. Do a quick estimate of if this pull request increases or decreases technical debt. Leave a message to future developers about why increased technical debt is worth it, or brag about how you figured out how to reduce technical debt.

## What are the follow-up tasks?

* Make setting the session length a constructor option to the SDK

## 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 committed Mar 13, 2017
1 parent 56891dd commit 203c09c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ const urlJoin = require('url-join');
const config = require('./config');
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 = {};

const DEFAULT_GREETINGS_REGEX = /^(get started|good(morning|afternoon)|hello|hey|hi|hola|what's up)/i;
Expand Down

0 comments on commit 203c09c

Please sign in to comment.