CruGlobal/godtools-api — pull request #33 by ryancarlson (2014-09-25 15:36:39+00:00)
Title: Asynchronous updates from OneSky

To ensure all parts of a draft are able to be previewed on the app, an asynchronous pull from OneSky is being introduced.
- asynchronous b/c OneSky's API is way too slow to make a user wait to do a full pull.
- when any user asks for a draft, a job which will execute 10 times, once every 30 seconds for that draft will do a full pull from OneSky
- the number of updates and frequency is configurable, but values should be chosen to respect OneSky's API and not hammer them with updates
- at the end of an pull, and the local database has been updated, the job will clear the draft from the cache, forcing the API to rebuild the draft with the latest values from the database (which were just pulled from OneSky)
- `DraftUpdateJob` will utilize memcached caching to insert a marker to the cache preventing other servers from doing the same draft's update simultaneously
- this would happen when users call GET draft abc on two different servers in a short time frame.
- this marker can be ignored (see next item)
- when publishing a translation, one final update is executed making sure that all the updates are pull from OneSky even if the user didn't hit update
- this is asynchronous as well.