Merge pull request #139 from matrix-org/dbkr/rate_limit_funcs

Make the function call-rate limiting a generic thing and use it in more places.
This commit is contained in:
David Baker 2016-02-05 10:15:55 +00:00
commit 0ae548cf5d
4 changed files with 50 additions and 34 deletions

View file

@ -41,6 +41,7 @@ var Resend = require("../../Resend");
var SlashCommands = require("../../SlashCommands");
var dis = require("../../dispatcher");
var Tinter = require("../../Tinter");
var rate_limited_func = require('../../ratelimitedfunc');
var PAGINATE_SIZE = 20;
var INITIAL_SIZE = 20;
@ -619,7 +620,7 @@ module.exports = React.createClass({
}
},
_updateTabCompleteList: function(room) {
_updateTabCompleteList: new rate_limited_func(function(room) {
if (!room || !this.tabComplete) {
return;
}
@ -628,7 +629,7 @@ module.exports = React.createClass({
CommandEntry.fromCommands(SlashCommands.getCommandList())
)
);
},
}, 500),
_initialiseMessagePanel: function() {
var messagePanel = ReactDOM.findDOMNode(this.refs.messagePanel);