DoSomething/ds-mdata-responder — pull request #208 by jonuy (2014-10-09 15:51:30+00:00)
Title: Decrease # of setTimeout calls and simplify closure data in each

#### What's this PR do?
In an effort to resolve the gradual memory increase we're seeing in the app, we're starting by trying to cleanup our use of `setTimeout` calls.

#### Where should the reviewer start?
* With `scheduleMobileCommonsOptIn()`, we're decreasing the number of setTimeout calls by just calling the `optin` method if `delay` is either undefined or 0.

* The logic to send a solo play message has been moved into `scheduleSoloMessage()`. Instead of passing in the entire context of the SGCompetitveStoryController object to be tracked in the closure, the callback only needs the game id, a reference to the game model, and the opt-in path. I'm not entirely sure if this is gonna show marked improvement, but it does at least simplify the data needed within the closure.

#### How should this be manually tested?
Successful test cases I manually went through:
* Creating game and receiving the solo-play message
* Creating game, having a beta join, and not receiving the solo-play message
* Creating game, having a beta join, and playing through the first level

Feel free to try those or any others you might think are worth trying

#### Any background context?
This is in response to some of the sporadic 502 errors the app is throwing. The hunch is that memory isn't getting properly cleaned up somewhere, and our first attempt is with these setTimeouts.