Skip to content
Browse files

Retry tweet in authorization timestamp issue

* This also includes a custom CES message
  • Loading branch information...
1 parent 37d5f4a commit 652958c2dd90721c3ac9fff227f629fdfe2bc4f9 @jadonk committed Jan 7, 2013
Showing with 10 additions and 2 deletions.
  1. +10 −2 tweetstache.js
View
12 tweetstache.js
@@ -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);
@@ -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) {
}

0 comments on commit 652958c

Please sign in to comment.
Something went wrong with that request. Please try again.