[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [onionoo/master] Stop returning code 500 when serving stale data.
commit 7c59c7c3ca336822aa424b31ae4d5eb6383c8026
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Sun Jan 10 09:48:50 2016 +0100
Stop returning code 500 when serving stale data.
Until now, when the hourly updater has not run for 6 hours or more,
the server responds to all queries with a 500 Internal Server Error.
This seemed to be a good idea, because users would tell us when the
hourly updater was broken and we could fix it. But actually, these 6
hours were chosen arbitrarily, and each application should decide for
itself when it considers data as stale. That's why we're taking out
the check and stopping to return a 500 status code because of
potentially stale data.
Implements #16907.
---
.../java/org/torproject/onionoo/server/ResourceServlet.java | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/main/java/org/torproject/onionoo/server/ResourceServlet.java b/src/main/java/org/torproject/onionoo/server/ResourceServlet.java
index 9b19d44..9aa460d 100644
--- a/src/main/java/org/torproject/onionoo/server/ResourceServlet.java
+++ b/src/main/java/org/torproject/onionoo/server/ResourceServlet.java
@@ -57,8 +57,7 @@ public class ResourceServlet extends HttpServlet {
this.doGet(requestWrapper, responseWrapper);
}
- private static final long INDEX_MAX_AGE = 6L * 60L * 60L * 1000L,
- CACHE_MIN_TIME = 5L * 60L * 1000L,
+ private static final long CACHE_MIN_TIME = 5L * 60L * 1000L,
CACHE_MAX_TIME = 45L * 60L * 1000L,
CACHE_INTERVAL = 5L * 60L * 1000L;
@@ -84,10 +83,6 @@ public class ResourceServlet extends HttpServlet {
NodeIndexerFactory.getNodeIndexer().getLastIndexed(
INDEX_WAITING_TIME);
long indexAgeMillis = nowMillis - indexWrittenMillis;
- if (indexAgeMillis > INDEX_MAX_AGE) {
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- return;
- }
long cacheMaxAgeMillis = Math.max(CACHE_MIN_TIME,
((CACHE_MAX_TIME - indexAgeMillis)
/ CACHE_INTERVAL) * CACHE_INTERVAL);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits