add logging related to fragments

both when rebuilding and when sorting will be used
This commit is contained in:
Bruno Windels 2020-03-20 20:23:07 +01:00
parent 096800d91a
commit 2f355cabef
2 changed files with 14 additions and 1 deletions

View file

@ -134,6 +134,13 @@ export default class FragmentIdComparer {
rebuild(fragments) {
const islands = createIslands(fragments);
const fragmentJson = JSON.stringify(islands.map(i => {
return Array.from(i._idToSortIndex.entries())
.map(([id, idx]) => {return {id, idx};})
.sort((a, b) => a.idx - b.idx);
}));
const firstFragment = this._fragmentsById.values().next().value;
console.log("rebuilt fragment index", firstFragment && firstFragment.roomId, fragmentJson);
this._idToIsland = new Map();
for(let island of islands) {
for(let id of island.fragmentIds) {

View file

@ -33,7 +33,13 @@ export default class Timeline {
/** @package */
appendLiveEntries(newEntries) {
this._remoteEntries.setManySorted(newEntries);
try {
this._remoteEntries.setManySorted(newEntries);
} catch (err) {
console.error("error while appending live entries in roomId", this._roomId);
console.error(err.stack);
throw err;
}
}
/** @public */