summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2019-01-23 18:23:31 -0600
committerOmar Roth <omarroth@hotmail.com>2019-01-23 18:23:31 -0600
commit15efac520eee51db6be278e8ebc72d515b70c6c8 (patch)
tree9c65ab8aa436fc9ef237e845c20a64363cfb4f01 /src
parent7a6a0f364c0b9614ec14b8663c9812759a561446 (diff)
downloadinvidious-15efac520eee51db6be278e8ebc72d515b70c6c8.tar.gz
invidious-15efac520eee51db6be278e8ebc72d515b70c6c8.tar.bz2
invidious-15efac520eee51db6be278e8ebc72d515b70c6c8.zip
Stop trying to pull comments after 10 timeouts
Diffstat (limited to 'src')
-rw-r--r--src/invidious/views/watch.ecr33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr
index 832d13d1..db7dcb7b 100644
--- a/src/invidious/views/watch.ecr
+++ b/src/invidious/views/watch.ecr
@@ -268,8 +268,15 @@ function unsubscribe() {
}
<% if plid %>
-function get_playlist() {
+function get_playlist(timeouts = 0) {
playlist = document.getElementById("playlist");
+
+ if (timeouts > 10) {
+ console.log("Failed to pull playlist");
+ playlist.innerHTML = "";
+ return;
+ }
+
playlist.innerHTML = ' \
<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3> \
<hr>'
@@ -323,15 +330,22 @@ function get_playlist() {
comments = document.getElementById("playlist");
comments.innerHTML =
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3><hr>';
- get_playlist();
+ get_playlist(timeouts + 1);
};
}
get_playlist();
<% end %>
-function get_reddit_comments() {
+function get_reddit_comments(timeouts = 0) {
comments = document.getElementById("comments");
+
+ if (timeouts > 10) {
+ console.log("Failed to pull comments");
+ comments.innerHTML = "";
+ return;
+ }
+
var fallback = comments.innerHTML;
comments.innerHTML =
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
@@ -382,12 +396,19 @@ function get_reddit_comments() {
xhr.ontimeout = function() {
console.log("Pulling comments timed out.");
- get_reddit_comments();
+ get_reddit_comments(timeouts + 1);
};
}
-function get_youtube_comments() {
+function get_youtube_comments(timeouts = 0) {
comments = document.getElementById("comments");
+
+ if (timeouts > 10) {
+ console.log("Failed to pull comments");
+ comments.innerHTML = "";
+ return;
+ }
+
var fallback = comments.innerHTML;
comments.innerHTML =
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
@@ -438,7 +459,7 @@ function get_youtube_comments() {
comments.innerHTML =
'<h3><center class="loading"><i class="icon ion-ios-refresh"></i></center></h3>';
- get_youtube_comments();
+ get_youtube_comments(timeouts + 1);
};
}