Skip to content

Commit

Permalink
When failing to get data from a vendor while having sent a badge from…
Browse files Browse the repository at this point in the history
… cache,

… we stop faster.
  • Loading branch information
espadrine committed May 2, 2014
1 parent 99d490e commit f477e1a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,15 @@ function cache(f) {
var serverUnresponsive = false;
var serverResponsive = setTimeout(function() {
serverUnresponsive = true;
if (cachedVersionSent) { return; }
if (requestCache.has(cacheIndex)) {
var cached = requestCache.get(cacheIndex).data;
if (!cachedVersionSent) {
badge(cached.badgeData, makeSend(cached.format, ask.res, end));
}
badge(cached.badgeData, makeSend(cached.format, ask.res, end));
return;
}
var badgeData = getBadgeData('vendor', data);
badgeData.text[1] = 'unresponsive';
if (!cachedVersionSent) {
badge(badgeData, makeSend('svg', ask.res, end));
}
badge(badgeData, makeSend('svg', ask.res, end));
}, 25000);

f(data, match, function sendBadge(format, badgeData) {
Expand Down

0 comments on commit f477e1a

Please sign in to comment.