send unsent messages after first sync

This commit is contained in:
Bruno Windels 2019-07-26 22:40:39 +02:00
parent 707988f806
commit 851100b88a
3 changed files with 11 additions and 0 deletions

View File

@ -76,6 +76,7 @@ export default async function main(container) {
if (needsInitialSync) {
showSession(container, session, sync);
}
session.notifyNetworkAvailable();
} catch(err) {
console.error(`${err.message}:\n${err.stack}`);
}

View File

@ -42,6 +42,10 @@ export default class Room extends EventEmitter {
}
}
resumeSending() {
this._sendQueue.resumeSending();
}
load(summary, txn) {
this._summary.load(summary);
return this._syncWriter.load(txn);

View File

@ -38,6 +38,12 @@ export default class Session {
}));
}
notifyNetworkAvailable() {
for (const room of this._rooms) {
room.resumeSending();
}
}
async _getPendingEventsByRoom(txn) {
const pendingEvents = await txn.pendingEvents.getAll();
return pendingEvents.reduce((groups, pe) => {