Commit 2e7f24b9 authored by nanahira's avatar nanahira

js

parent 3fb2b1f0
...@@ -338,6 +338,7 @@ ...@@ -338,6 +338,7 @@
}); });
}; };
challonge.participants._index = function(_data) { challonge.participants._index = function(_data) {
var err;
if (settings.modules.challonge.cache_ttl && challonge_cache[0]) { if (settings.modules.challonge.cache_ttl && challonge_cache[0]) {
_data.callback(null, challonge_cache[0]); _data.callback(null, challonge_cache[0]);
} else if (is_requesting[0] && moment() - is_requesting[0] <= 5000) { } else if (is_requesting[0] && moment() - is_requesting[0] <= 5000) {
...@@ -345,10 +346,16 @@ ...@@ -345,10 +346,16 @@
} else { } else {
_data.callback = get_callback(0, _data.callback); _data.callback = get_callback(0, _data.callback);
is_requesting[0] = moment(); is_requesting[0] = moment();
challonge.participants.index(_data); try {
challonge.participants.index(_data);
} catch (error1) {
err = error1;
_data.callback(err, null);
}
} }
}; };
challonge.matches._index = function(_data) { challonge.matches._index = function(_data) {
var err;
if (settings.modules.challonge.cache_ttl && challonge_cache[1]) { if (settings.modules.challonge.cache_ttl && challonge_cache[1]) {
_data.callback(null, challonge_cache[1]); _data.callback(null, challonge_cache[1]);
} else if (is_requesting[1] && moment() - is_requesting[1] <= 5000) { } else if (is_requesting[1] && moment() - is_requesting[1] <= 5000) {
...@@ -356,7 +363,12 @@ ...@@ -356,7 +363,12 @@
} else { } else {
_data.callback = get_callback(1, _data.callback); _data.callback = get_callback(1, _data.callback);
is_requesting[1] = moment(); is_requesting[1] = moment();
challonge.matches.index(_data); try {
challonge.matches.index(_data);
} catch (error1) {
err = error1;
_data.callback(err, null);
}
} }
}; };
challonge.matches._update = function(_data) { challonge.matches._update = function(_data) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment