Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Retry tweet in authorization timestamp issue

* This also includes a custom CES message
  • Loading branch information...
commit 652958c2dd90721c3ac9fff227f629fdfe2bc4f9 1 parent 37d5f4a
Jason Kridner authored

Showing 1 changed file with 10 additions and 2 deletions. Show diff stats Hide diff stats

  1. +10 2 tweetstache.js
12 tweetstache.js
@@ -132,7 +132,15 @@ function sendTweet(tweet, photoName) {
132 132 function printStatusCode() {
133 133 winston.info(response.statusCode +'\n');
134 134 if(response.statusCode == 200) led.off();
135   - else led.blink();
  135 + else {
  136 + led.blink();
  137 + if(response.statusCode == 401) {
  138 + var resendTweet = function() {
  139 + sendTweet(tweet, photoName);
  140 + }
  141 + setTimeout(resendTweet, 60000);
  142 + }
  143 + }
136 144 };
137 145 response.setEncoding('utf8');
138 146 response.on('data', printChunk);
@@ -152,7 +160,7 @@ function stacheMessage(data) {
152 160 if(data.tweet && data.filename) {
153 161 winston.info('stacheMessage = ' + JSON.stringify(data));
154 162 led.on();
155   - sendTweet(data.tweet, data.filename);
  163 + sendTweet("New #BeagleBone BeagleStache image captured at #2013CES #CESInnovate @BeagleBoardOrg", data.filename);
156 164 }
157 165 } catch(ex) {
158 166 }

0 comments on commit 652958c

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