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).
This commit is contained in:
parent
6e832c7d73
commit
3947a72d1b
1 changed files with 10 additions and 2 deletions
|
@ -157,17 +157,25 @@ class FlairStore {
|
|||
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] = {
|
||||
groupId,
|
||||
avatarUrl: profile.avatar_url,
|
||||
name: profile.name,
|
||||
shortDescription: profile.short_description,
|
||||
};
|
||||
delete this._groupProfilesPromise[groupId];
|
||||
|
||||
setTimeout(() => {
|
||||
delete this._groupProfiles[groupId];
|
||||
delete this._groupProfilesPromise[groupId];
|
||||
}, GROUP_PROFILES_CACHE_BUST_MS);
|
||||
|
||||
return this._groupProfiles[groupId];
|
||||
|
|
Loading…
Reference in a new issue