Created
March 2, 2011 16:28
-
-
Save brianloveswords/851205 to your computer and use it in GitHub Desktop.
This file contains 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
db.open(function(err, client){ | |
var is_setup = null; | |
var hash_col = null; | |
var user_col = null; | |
var continue_execution = function(){ | |
if ( !(is_setup && hash_col && user_col) ) return false; | |
sys.puts('setup and found collections'); | |
start_stream(); | |
return true; | |
}; | |
// setup stuff | |
db.createCollection('hashtag', function(err, collection){ | |
console.log('ready with hashtag'); | |
hash_col = collection; | |
continue_execution(); | |
}); | |
db.createCollection('user', function(err, collection){ | |
console.log('ready with user'); | |
user_col = collection; | |
continue_execution(); | |
}); | |
var prepare_stream_watcher = (function () { | |
winston.add(winston.transports.File, {filename: 'status.log'}); | |
twit.headers['User-Agent'] = 'DML Game Follower'; | |
twit.addListener('error', function(error){ | |
winston.error(error.message); | |
}).addListener('tweet', function(tweet){ | |
winston.info('@' + tweet.user.screen_name + ': ' + tweet.text); | |
tweet_parser(tweet); | |
}).addListener('end', function(resp) { | |
winston.info("disconnected: " + resp.statusCode); | |
}); | |
is_setup = true; | |
continue_execution(); | |
})(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment