Merge branch 'develop' into pr/ThatOneCalculator/8764
This commit is contained in:
commit
7ddfd049a4
234 changed files with 7586 additions and 783 deletions
|
@ -37,12 +37,22 @@ class SwNotificationReadManager {
|
|||
|
||||
account.queue.push(data.body.id as string);
|
||||
|
||||
if (account.queue.length >= 20) {
|
||||
if (account.timeout) clearTimeout(account.timeout);
|
||||
const notificationIds = account.queue;
|
||||
account.queue = [];
|
||||
await api('notifications/read', data.userId, { notificationIds });
|
||||
return;
|
||||
}
|
||||
|
||||
// 最後の呼び出しから200ms待ってまとめて処理する
|
||||
if (account.timeout) clearTimeout(account.timeout);
|
||||
account.timeout = setTimeout(() => {
|
||||
account.timeout = null;
|
||||
|
||||
api('notifications/read', data.userId, { notificationIds: account.queue });
|
||||
const notificationIds = account.queue;
|
||||
account.queue = [];
|
||||
api('notifications/read', data.userId, { notificationIds });
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue