mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-10-01 01:36:06 -04:00
await the callback in getUserMessagesIn
This is so that the context of failing callbacks are not lost. We also await during pagination and not after so that if a call to the callback fails, we will not call it again.
This commit is contained in:
parent
fefe29e98b
commit
911707ab2e
@ -159,7 +159,9 @@ export async function getMessagesByUserIn(client: MatrixClient, sender: string,
|
|||||||
}
|
}
|
||||||
const events = filterEvents(bfMessages['chunk'] || []);
|
const events = filterEvents(bfMessages['chunk'] || []);
|
||||||
// If we are using a glob, there may be no relevant events in this chunk.
|
// If we are using a glob, there may be no relevant events in this chunk.
|
||||||
if (events.length > 0) cb(events);
|
if (events.length > 0) {
|
||||||
|
await cb(events);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Internal Error: rooms/initialSync did not return a pagination chunk for ${roomId}, this is not normal and if it is we need to stop using it. See roomInitialSync() for why we are using it.`);
|
throw new Error(`Internal Error: rooms/initialSync did not return a pagination chunk for ${roomId}, this is not normal and if it is we need to stop using it. See roomInitialSync() for why we are using it.`);
|
||||||
|
Loading…
Reference in New Issue
Block a user