Skip to content

Instantly share code, notes, and snippets.

@chapel
Created October 17, 2010 09:24
Show Gist options
  • Save chapel/630686 to your computer and use it in GitHub Desktop.
Save chapel/630686 to your computer and use it in GitHub Desktop.
function getGame(gameIds) {
gameIds.some(function(gameId) {
db.getDoc(gameId, function(er, doc) {
//console.log('db.getDoc');
if (er) {
//console.log('db.getDoc > er');
httpGet(url+gameId, function(data) {
//console.log('db.getDoc > er > httpGet');
db.saveDoc(gameId, data, function(er, ok) {
if (er) throw new Error(JSON.stringify(er));
sys.puts('Saved '+gameId+' to couch');
});
});
}
else parseGame(doc);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment