Fix to allow subsequent group profile requests if one fails
Also, delete the groupProfilePromise immediately after setting the group profile (the first if-statement will prevent a new request from being started).pull/21833/head
parent
6e832c7d73
commit
3947a72d1b
|
@ -157,17 +157,25 @@ class FlairStore {
|
||||||
this._groupProfilesPromise[groupId] = matrixClient.getGroupProfile(groupId);
|
this._groupProfilesPromise[groupId] = matrixClient.getGroupProfile(groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
const profile = await this._groupProfilesPromise[groupId];
|
let profile;
|
||||||
|
try {
|
||||||
|
profile = await this._groupProfilesPromise[groupId];
|
||||||
|
} catch (e) {
|
||||||
|
// Don't retry, but allow a retry when the profile is next requested
|
||||||
|
delete this._groupProfilesPromise[groupId];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._groupProfiles[groupId] = {
|
this._groupProfiles[groupId] = {
|
||||||
groupId,
|
groupId,
|
||||||
avatarUrl: profile.avatar_url,
|
avatarUrl: profile.avatar_url,
|
||||||
name: profile.name,
|
name: profile.name,
|
||||||
shortDescription: profile.short_description,
|
shortDescription: profile.short_description,
|
||||||
};
|
};
|
||||||
|
delete this._groupProfilesPromise[groupId];
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
delete this._groupProfiles[groupId];
|
delete this._groupProfiles[groupId];
|
||||||
delete this._groupProfilesPromise[groupId];
|
|
||||||
}, GROUP_PROFILES_CACHE_BUST_MS);
|
}, GROUP_PROFILES_CACHE_BUST_MS);
|
||||||
|
|
||||||
return this._groupProfiles[groupId];
|
return this._groupProfiles[groupId];
|
||||||
|
|
Loading…
Reference in New Issue