Show tracker error message on high error percentage

This commit is contained in:
shortcutme 2018-04-29 13:06:07 +02:00
parent 247b89aec5
commit 81ec684025
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 11 additions and 18 deletions

View file

@ -538,17 +538,16 @@ class Wrapper
@event_site_info.resolve()
setAnnouncerInfo: (announcer_info) ->
status_db = {}
status_db = {announcing: [], error: [], announced: []}
for key, val of announcer_info.stats
status_db[val.status] ?= []
status_db[val.status].push(val)
status_line = "Trackers announcing: #{status_db.announcing?.length or 0}, error: #{status_db.error?.length or 0}, done: #{status_db.announced?.length or 0}"
status_line = "Trackers announcing: #{status_db.announcing.length}, error: #{status_db.error.length}, done: #{status_db.announced.length}"
if @announcer_line
@announcer_line.text(status_line)
else
@announcer_line = @loading.printLine(status_line)
if status_db.error?.length == (key for key of announcer_info.stats).length
if status_db.error.length > (status_db.announced.length + status_db.announcing.length)
@loading.showTrackerTorBridge(@server_info)
updateProgress: (site_info) ->

View file

@ -1617,30 +1617,24 @@ jQuery.extend( jQuery.easing,
};
Wrapper.prototype.setAnnouncerInfo = function(announcer_info) {
var key, name, ref, ref1, ref2, ref3, ref4, status_db, status_line, val;
status_db = {};
var key, ref, status_db, status_line, val;
status_db = {
announcing: [],
error: [],
announced: []
};
ref = announcer_info.stats;
for (key in ref) {
val = ref[key];
if (status_db[name = val.status] == null) {
status_db[name] = [];
}
status_db[val.status].push(val);
}
status_line = "Trackers announcing: " + (((ref1 = status_db.announcing) != null ? ref1.length : void 0) || 0) + ", error: " + (((ref2 = status_db.error) != null ? ref2.length : void 0) || 0) + ", done: " + (((ref3 = status_db.announced) != null ? ref3.length : void 0) || 0);
status_line = "Trackers announcing: " + status_db.announcing.length + ", error: " + status_db.error.length + ", done: " + status_db.announced.length;
if (this.announcer_line) {
this.announcer_line.text(status_line);
} else {
this.announcer_line = this.loading.printLine(status_line);
}
if (((ref4 = status_db.error) != null ? ref4.length : void 0) === ((function() {
var results;
results = [];
for (key in announcer_info.stats) {
results.push(key);
}
return results;
})()).length) {
if (status_db.error.length > (status_db.announced.length + status_db.announcing.length)) {
return this.loading.showTrackerTorBridge(this.server_info);
}
};