Stop polling notes when response is not 200
Follow up of https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15140
We can prevent some useless requests if we stop polling notes when response is not 200.
Notes polling continue even if user loses access to a noteable or a legit error is happening.
Suggestion:
Fix notes.js adding clearInterval(Notes.interval); to the error callback:
getContent() {
if (this.refreshing) {
return;
}
this.refreshing = true;
return $.ajax({
url: this.notes_url,
headers: { 'X-Last-Fetched-At': this.last_fetched_at },
dataType: 'json',
success: (function(_this) {
return function(data) {
var notes;
notes = data.notes;
_this.last_fetched_at = data.last_fetched_at;
_this.setPollingInterval(data.notes.length);
return $.each(notes, function(i, note) {
_this.renderNote(note);
});
};
})(this)
}).always((function(_this) {
return function() {
return _this.refreshing = false;
};
})(this));
}
Edited by 🤖 GitLab Bot 🤖