summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend.php4
-rw-r--r--feedlist.js24
-rw-r--r--viewfeed.js9
3 files changed, 30 insertions, 7 deletions
diff --git a/backend.php b/backend.php
index ba7cbdb0b..94a63dae1 100644
--- a/backend.php
+++ b/backend.php
@@ -210,11 +210,11 @@
}
}
- if ($mode != "prefetch_old") {
+/* if ($mode != "prefetch_old") {
print "<counters>";
getAllCounters($link, $omode);
print "</counters>";
- }
+ } */
print "</reply>";
break; // view
diff --git a/feedlist.js b/feedlist.js
index df30a6107..b4a0e8832 100644
--- a/feedlist.js
+++ b/feedlist.js
@@ -496,7 +496,7 @@ function mouse_up_handler(e) {
}
}
-function request_counters() {
+function request_counters_real() {
try {
var query = "backend.php?op=rpc&subop=getAllCounters";
@@ -517,6 +517,28 @@ function request_counters() {
} });
} catch (e) {
+ exception_error("request_counters_real", e);
+ }
+}
+
+var counters_last_request = 0;
+
+function request_counters() {
+
+ try {
+
+ var date = new Date();
+ var timestamp = Math.round(date.getTime() / 1000);
+
+ if (timestamp - counters_last_request > 10) {
+ debug("scheduling request of counters...");
+ window.setTimeout("request_counters_real()", 100);
+ counters_last_request = timestamp;
+ } else {
+ debug("request_counters: rate limit reached: " + (timestamp - counters_last_request));
+ }
+
+ } catch (e) {
exception_error("request_counters", e);
}
}
diff --git a/viewfeed.js b/viewfeed.js
index 16f96216a..bd548ced9 100644
--- a/viewfeed.js
+++ b/viewfeed.js
@@ -325,7 +325,7 @@ function article_callback2(transport, id, feed_id) {
active_real_feed_id = feed_id;
active_post_id = id;
- //showArticleInHeadlines(id);
+ showArticleInHeadlines(id);
var reply = transport.responseXML.firstChild.firstChild;
@@ -367,7 +367,8 @@ function article_callback2(transport, id, feed_id) {
debug("parsing piggybacked counters: " + counters);
parse_counters(counters, false);
} else {
- debug("counters container not found in reply");
+ debug("counters container not found in reply, requesting...");
+ request_counters();
}
}
@@ -426,8 +427,6 @@ function view(id, feed_id, skip_history) {
var crow = document.getElementById("RROW-" + id);
var article_is_unread = crow.className.match("Unread");
- showArticleInHeadlines(id);
-
if (!cached_article) {
notify_progress("Loading, please wait...");
@@ -442,6 +441,8 @@ function view(id, feed_id, skip_history) {
query = query + "&mode=prefetch_old";
render_article(cached_article);
+ showArticleInHeadlines(id);
+
}
cache_expire();