Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions ee/packages/presence/src/Presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,17 @@ export class Presence extends ServiceClass implements IPresence {
override async started(): Promise<void> {
this.reaper.start();
this.lostConTimeout = setTimeout(async () => {
const affectedUsers = await this.removeLostConnections();
return affectedUsers.forEach((uid) => this.updateUserPresence(uid));
const lock = await this.api?.lock('presence.removeLostConnections', 5000);
if (!lock) {
return;
}

try {
const affectedUsers = await this.removeLostConnections();
affectedUsers.forEach((uid) => this.updateUserPresence(uid));
} finally {
await lock.release();
}
}, 10000);

try {
Expand Down