2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
|
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
}, delay);
}
//console.log("isOkay =",isOkay,"currentDelay =",Chat.timer.currentDelay);
}
};
afterPollFetch.isFirstCall = true;
/**
FIXME: when polling fails because the remote server is
reachable but it's not accepting HTTP requests, we should back
off on polling for a while. e.g. if the remote web server process
is killed, the poll fails quickly and immediately retries,
hammering the remote server until the httpd is back up. That
happens often during development of this application.
XHR does not offer a direct way of distinguishing between
HTTP/connection errors, but we can hypothetically use the
xhrRequest.status value to do so, with status==0 being a
connection error. We do not currently have a clean way of passing
that info back to the fossil.fetch() client, so we'll need to
hammer on that API a bit to get this working.
*/
const poll = Chat.poll = async function f(){
if(f.running) return;
f.running = true;
Chat._isBatchLoading = f.isFirstCall;
if(true===f.isFirstCall){
f.isFirstCall = false;
Chat.aPollErr = [];
|