Skip to content

Commit

Permalink
removed ia archiving, since heroku goes to sleep and concerns about t…
Browse files Browse the repository at this point in the history
…witter ToS
  • Loading branch information
edsu committed Dec 30, 2015
1 parent 79b7768 commit 0133555
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 28 deletions.
26 changes: 3 additions & 23 deletions app.js
Expand Up @@ -28,7 +28,7 @@ function main() {

io.sockets.on('connection', function(socket) {
// don't send all of the latest tweets it can cause a lag
_.each(latest.slice(-10), function(t) {socket.emit('tweet', t);});
_.each(latest, function(t) {socket.emit('tweet', t);});
sockets.push(socket);
socket.on('disconnect', function() {
sockets = _.without(sockets, socket);
Expand Down Expand Up @@ -118,29 +118,9 @@ function getArticle(url, callback) {

function addLatest(msg) {
latest.push(msg);
if (latest.length > dumpSize) archive();
}

function archive() {
var now = new Date();
if (archiving && now - archiving < 61 * 1000) {
console.log("looks like an archive is underway");
return;
if (latest.length > 25) {
latest = latest.slice(-25);
}

archiving = now;
var name = "/" + dateformat(now, 'yyyymmddhhmmss') + '.json';
var value = JSON.stringify(latest, null, 2);
latest = [];

var c = ia.createClient({
accessKey: config.ia_access_key,
secretKey: config.ia_secret_key,
bucket: config.ia_bucket
});
c.addObject({name: name, value: value}, function() {
console.log("archived " + name);
});
}

function addArticleSummary(article, callback) {
Expand Down
5 changes: 1 addition & 4 deletions config.json.tmpl
Expand Up @@ -3,8 +3,5 @@
"consumer_key": "your",
"consumer_secret": "twitter",
"access_token_key": "keys",
"access_token_secret": "here",
"ia_bucket": "wikitweets",
"ia_access_key": "internet",
"ia_secret_key": "archive"
"access_token_secret": "here"
}
1 change: 0 additions & 1 deletion public/index.html
Expand Up @@ -57,7 +57,6 @@
t
s</pre>
<p>wikitweets is an experimental visualization of how wikipedia is cited on twitter</p>
<p>tweets are archived at <a href="http://archive.org/details/wikitweets">Internet Archive</a></p>
<p>to see how it works please see the <a href="http://github.com/edsu/wikitweets">wikitweets</a> project page on github</p>
</header>
<section id="tweets"></section>
Expand Down

0 comments on commit 0133555

Please sign in to comment.