Fix for unread syncs and ooo reactions
This commit is contained in:
parent
55f0beaa6d
commit
62e04a1bbd
7 changed files with 178 additions and 102 deletions
30
ts/util/StartupQueue.ts
Normal file
30
ts/util/StartupQueue.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
export class StartupQueue {
|
||||
set: Set<string>;
|
||||
|
||||
items: Array<() => void>;
|
||||
|
||||
constructor() {
|
||||
this.set = new Set();
|
||||
this.items = [];
|
||||
}
|
||||
|
||||
add(id: string, f: () => void): void {
|
||||
if (this.set.has(id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.items.push(f);
|
||||
this.set.add(id);
|
||||
}
|
||||
|
||||
flush(): void {
|
||||
const { items } = this;
|
||||
window.log.info('StartupQueue: Processing', items.length, 'actions');
|
||||
items.forEach(f => f());
|
||||
this.items = [];
|
||||
this.set.clear();
|
||||
}
|
||||
}
|
|
@ -33,10 +33,12 @@ import {
|
|||
sessionStructureToArrayBuffer,
|
||||
} from './sessionTranslation';
|
||||
import * as zkgroup from './zkgroup';
|
||||
import { StartupQueue } from './StartupQueue';
|
||||
|
||||
export {
|
||||
GoogleChrome,
|
||||
Registration,
|
||||
StartupQueue,
|
||||
arrayBufferToObjectURL,
|
||||
combineNames,
|
||||
createBatcher,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue