Created
          October 17, 2010 09:24 
        
      - 
      
- 
        Save chapel/630686 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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