Skip to content

Commit

Permalink
Retry tweet in authorization timestamp issue
Browse files Browse the repository at this point in the history
* This also includes a custom CES message
  • Loading branch information
Jason Kridner committed Jan 10, 2013
1 parent 37d5f4a commit 652958c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tweetstache.js
Expand Up @@ -132,7 +132,15 @@ function sendTweet(tweet, photoName) {
function printStatusCode() {
winston.info(response.statusCode +'\n');
if(response.statusCode == 200) led.off();
else led.blink();
else {
led.blink();
if(response.statusCode == 401) {
var resendTweet = function() {
sendTweet(tweet, photoName);
}
setTimeout(resendTweet, 60000);
}
}
};
response.setEncoding('utf8');
response.on('data', printChunk);
Expand All @@ -152,7 +160,7 @@ function stacheMessage(data) {
if(data.tweet && data.filename) {
winston.info('stacheMessage = ' + JSON.stringify(data));
led.on();
sendTweet(data.tweet, data.filename);
sendTweet("New #BeagleBone BeagleStache image captured at #2013CES #CESInnovate @BeagleBoardOrg", data.filename);
}
} catch(ex) {
}
Expand Down

0 comments on commit 652958c

Please sign in to comment.