Throttle calls to getProfile when opening conversation

We don't want to throttle other calls to getProfile, so we localize this
to the fetch we do when we first open a conversation.

FREEBIE
This commit is contained in:
Scott Nonnenberg 2017-07-12 16:04:10 -07:00
parent aa80cdd74d
commit 5da324103a

View file

@ -108,7 +108,11 @@
this.lazyUpdateVerified = _.debounce(
this.model.updateVerified.bind(this.model),
1000
1000 // one second
);
this.throttledGetProfiles = _.throttle(
this.model.getProfiles.bind(this.model),
1000 * 60 * 5 // five minutes
);
this.render();
@ -320,7 +324,7 @@
onOpened: function() {
// TODO: we may want to show a loading dialog until this status fetch
// and potentially the below message fetch are complete.
this.statusFetch = this.model.getProfiles().then(function() {
this.statusFetch = this.throttledGetProfiles().then(function() {
this.model.updateVerified().then(function() {
this.onVerifiedChange();
this.statusFetch = null;