[mastodon-client] Prevent updateUserInBackground from running excessively

This commit is contained in:
Laura Hausmann 2023-10-18 13:20:20 +02:00
parent 062d256a67
commit 4748f30214
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -528,9 +528,15 @@ export class UserHelpers {
});
}
public static updateUserInBackground(user: User) {
public static async updateUserInBackground(user: User) {
if (Users.isLocalUser(user)) return;
// noinspection JSIgnoredPromiseFromCall
if (user.lastFetchedAt != null && Date.now() - user.lastFetchedAt.getTime() < 1000 * 60 * 60 * 24) return;
await Users.update(user.id, {
lastFetchedAt: new Date(),
});
// noinspection ES6MissingAwait
updatePerson(user.uri!, undefined, undefined, user as IRemoteUser);
}