check for failures to request counters in async way after viewfeed/view
This commit is contained in:
parent
06c88b8dc3
commit
6cc1fab322
13
backend.php
13
backend.php
|
@ -193,6 +193,8 @@
|
||||||
$mode = db_escape_string($_GET["mode"]);
|
$mode = db_escape_string($_GET["mode"]);
|
||||||
$omode = db_escape_string($_GET["omode"]);
|
$omode = db_escape_string($_GET["omode"]);
|
||||||
|
|
||||||
|
$csync = $_GET["csync"];
|
||||||
|
|
||||||
print "<reply>";
|
print "<reply>";
|
||||||
|
|
||||||
// in prefetch mode we only output requested cids, main article
|
// in prefetch mode we only output requested cids, main article
|
||||||
|
@ -210,7 +212,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode != "prefetch_old") {
|
if ($mode != "prefetch_old" && !$csync) {
|
||||||
print "<counters>";
|
print "<counters>";
|
||||||
getAllCounters($link, $omode);
|
getAllCounters($link, $omode);
|
||||||
print "</counters>";
|
print "</counters>";
|
||||||
|
@ -238,6 +240,7 @@
|
||||||
$next_unread_feed = db_escape_string($_GET["nuf"]);
|
$next_unread_feed = db_escape_string($_GET["nuf"]);
|
||||||
$offset = db_escape_string($_GET["skip"]);
|
$offset = db_escape_string($_GET["skip"]);
|
||||||
$vgroup_last_feed = db_escape_string($_GET["vgrlf"]);
|
$vgroup_last_feed = db_escape_string($_GET["vgrlf"]);
|
||||||
|
$csync = $_GET["csync"];
|
||||||
|
|
||||||
set_pref($link, "_DEFAULT_VIEW_MODE", $view_mode);
|
set_pref($link, "_DEFAULT_VIEW_MODE", $view_mode);
|
||||||
set_pref($link, "_DEFAULT_VIEW_LIMIT", $limit);
|
set_pref($link, "_DEFAULT_VIEW_LIMIT", $limit);
|
||||||
|
@ -288,7 +291,13 @@
|
||||||
|
|
||||||
if ($_GET["debug"]) $timing_info = print_checkpoint("20", $timing_info);
|
if ($_GET["debug"]) $timing_info = print_checkpoint("20", $timing_info);
|
||||||
|
|
||||||
if (time() - $_SESSION["get_all_counters_stamp"] > 300) {
|
$viewfeed_ctr_interval = 300;
|
||||||
|
|
||||||
|
if ($csync) {
|
||||||
|
$viewfeed_ctr_interval = 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (time() - $_SESSION["get_all_counters_stamp"] > $viewfeed_ctr_interval) {
|
||||||
print "<counters>";
|
print "<counters>";
|
||||||
getAllCounters($link, $omode, $feed);
|
getAllCounters($link, $omode, $feed);
|
||||||
print "</counters>";
|
print "</counters>";
|
||||||
|
|
|
@ -168,6 +168,10 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
|
||||||
query = query + "&omode=flc";
|
query = query + "&omode=flc";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!async_counters_work) {
|
||||||
|
query = query + "&csync=true";
|
||||||
|
}
|
||||||
|
|
||||||
debug(query);
|
debug(query);
|
||||||
|
|
||||||
var container = document.getElementById("headlinesInnerContainer");
|
var container = document.getElementById("headlinesInnerContainer");
|
||||||
|
@ -517,7 +521,7 @@ function request_counters_real() {
|
||||||
new Ajax.Request(query, {
|
new Ajax.Request(query, {
|
||||||
onComplete: function(transport) {
|
onComplete: function(transport) {
|
||||||
try {
|
try {
|
||||||
all_counters_callback2(transport);
|
all_counters_callback2(transport, true);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error("viewfeed/getcounters", e);
|
exception_error("viewfeed/getcounters", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ var hotkeys_enabled = true;
|
||||||
var xmlhttp_rpc = Ajax.getTransport();
|
var xmlhttp_rpc = Ajax.getTransport();
|
||||||
var notify_silent = false;
|
var notify_silent = false;
|
||||||
var last_progress_point = 0;
|
var last_progress_point = 0;
|
||||||
|
var async_counters_work = false;
|
||||||
|
|
||||||
/* add method to remove element from array */
|
/* add method to remove element from array */
|
||||||
|
|
||||||
|
@ -626,8 +627,10 @@ function parse_counters_reply(transport, scheduled_call) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function all_counters_callback2(transport) {
|
function all_counters_callback2(transport, async_call) {
|
||||||
try {
|
try {
|
||||||
|
if (async_call) async_counters_work = true;
|
||||||
|
|
||||||
debug("<b>all_counters_callback2 IN: " + transport + "</b>");
|
debug("<b>all_counters_callback2 IN: " + transport + "</b>");
|
||||||
parse_counters_reply(transport);
|
parse_counters_reply(transport);
|
||||||
debug("<b>all_counters_callback2 OUT: " + transport + "</b>");
|
debug("<b>all_counters_callback2 OUT: " + transport + "</b>");
|
||||||
|
|
|
@ -431,6 +431,10 @@ function view(id, feed_id, skip_history) {
|
||||||
var crow = document.getElementById("RROW-" + id);
|
var crow = document.getElementById("RROW-" + id);
|
||||||
var article_is_unread = crow.className.match("Unread");
|
var article_is_unread = crow.className.match("Unread");
|
||||||
|
|
||||||
|
if (!async_counters_work) {
|
||||||
|
query = query + "&csync=true";
|
||||||
|
}
|
||||||
|
|
||||||
if (!cached_article) {
|
if (!cached_article) {
|
||||||
|
|
||||||
notify_progress("Loading, please wait...");
|
notify_progress("Loading, please wait...");
|
||||||
|
|
Loading…
Reference in New Issue