Commit d4654527 authored by nanahira's avatar nanahira

Merge branch 'mc'

parents fb906615 2e7f24b9
...@@ -398,7 +398,10 @@ if settings.modules.challonge.enabled ...@@ -398,7 +398,10 @@ if settings.modules.challonge.enabled
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 err
_data.callback(err, null)
return return
challonge.matches._index = (_data) -> challonge.matches._index = (_data) ->
if settings.modules.challonge.cache_ttl and challonge_cache[1] if settings.modules.challonge.cache_ttl and challonge_cache[1]
...@@ -408,7 +411,10 @@ if settings.modules.challonge.enabled ...@@ -408,7 +411,10 @@ if settings.modules.challonge.enabled
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 err
_data.callback(err, null)
return return
challonge.matches._update = (_data) -> challonge.matches._update = (_data) ->
try try
......
...@@ -486,6 +486,7 @@ ...@@ -486,6 +486,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) {
...@@ -493,10 +494,16 @@ ...@@ -493,10 +494,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) {
...@@ -504,7 +511,12 @@ ...@@ -504,7 +511,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