Make sure we don't create multiple timeouts for the usage bar

pull/1/head
yflory 4 years ago
parent 7b666119c5
commit 5535595096

@ -1179,9 +1179,14 @@ define([
// getPinnedUsage updates common.account.usage, and other values // getPinnedUsage updates common.account.usage, and other values
// so we can just use those and only check for errors // so we can just use those and only check for errors
var $container = $('<span>', {'class':'cp-limit-container'}); var $container = $('<span>', {'class':'cp-limit-container'});
var to;
var todo = function (err, data) { var todo = function (err, data) {
if (to) {
clearTimeout(to);
to = undefined;
}
if (err === 'RPC_NOT_READY') { if (err === 'RPC_NOT_READY') {
setTimeout(function () { to = setTimeout(function () {
common.getPinUsage(teamId, todo); common.getPinUsage(teamId, todo);
}, 1000); }, 1000);
return; return;

Loading…
Cancel
Save