Startup message counter: increment on message processing complete
This commit is contained in:
parent
e59d095ffb
commit
1632e19476
2 changed files with 17 additions and 5 deletions
|
@ -877,7 +877,6 @@
|
||||||
addQueuedEventListener('error', onError);
|
addQueuedEventListener('error', onError);
|
||||||
addQueuedEventListener('empty', onEmpty);
|
addQueuedEventListener('empty', onEmpty);
|
||||||
addQueuedEventListener('reconnect', onReconnect);
|
addQueuedEventListener('reconnect', onReconnect);
|
||||||
addQueuedEventListener('progress', onProgress);
|
|
||||||
addQueuedEventListener('configuration', onConfiguration);
|
addQueuedEventListener('configuration', onConfiguration);
|
||||||
addQueuedEventListener('typing', onTyping);
|
addQueuedEventListener('typing', onTyping);
|
||||||
addQueuedEventListener('sticker-pack', onStickerPack);
|
addQueuedEventListener('sticker-pack', onStickerPack);
|
||||||
|
@ -1038,15 +1037,27 @@
|
||||||
deliveryReceiptQueue.pause();
|
deliveryReceiptQueue.pause();
|
||||||
Whisper.Notifications.disable();
|
Whisper.Notifications.disable();
|
||||||
}
|
}
|
||||||
function onProgress(ev) {
|
|
||||||
const { count } = ev;
|
let initialStartupCount = 0;
|
||||||
window.log.info(`onProgress: Message count is ${count}`);
|
Whisper.events.on('incrementProgress', incrementProgress);
|
||||||
|
function incrementProgress() {
|
||||||
|
initialStartupCount += 1;
|
||||||
|
|
||||||
|
// Only update progress every 10 items
|
||||||
|
if (initialStartupCount % 10 !== 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.log.info(
|
||||||
|
`incrementProgress: Message count is ${initialStartupCount}`
|
||||||
|
);
|
||||||
|
|
||||||
const view = window.owsDesktopApp.appView;
|
const view = window.owsDesktopApp.appView;
|
||||||
if (view) {
|
if (view) {
|
||||||
view.onProgress(count);
|
view.onProgress(initialStartupCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onConfiguration(ev) {
|
function onConfiguration(ev) {
|
||||||
ev.confirm();
|
ev.confirm();
|
||||||
|
|
||||||
|
|
|
@ -2110,6 +2110,7 @@
|
||||||
await conversation.notify(message);
|
await conversation.notify(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Whisper.events.trigger('incrementProgress');
|
||||||
confirm();
|
confirm();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const errorForLog = error && error.stack ? error.stack : error;
|
const errorForLog = error && error.stack ? error.stack : error;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue