Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timeline back-filling spinning indefinitely #1009

Closed
bwindels opened this issue Jan 31, 2023 · 2 comments · Fixed by #1028
Closed

Fix timeline back-filling spinning indefinitely #1009

bwindels opened this issue Jan 31, 2023 · 2 comments · Fixed by #1028
Labels
bug Something isn't working

Comments

@bwindels
Copy link
Contributor

bwindels commented Jan 31, 2023

Hydrogen seems unhappy with the /messages response in some rooms because synapse returns a different value for start then what I provide as the from query parameter. The only difference seems to be that synapse appends _0 to the token. So I have t37-1342550139\_757284974\_7971954\_1695409504\_1724035178\_3720015\_646406111\_5691777095\_0in?fromand t37-1342550139\_757284974\_7971954\_1695409504\_1724035178\_3720015\_646406111\_5691777095\_0\_0forstartin the response body. Hydrogen checks that the token used for the request is the same as in the database when the response comes back to make sure no part of the timeline is being swallowed due to a race.

The error in the console is start is not equal to prev_batch or next_batch , see GapWriter.writeFragmentFill

We should just keep the token I sent the request with in memory rather than looking atstart in the response body.

@bwindels bwindels added the bug Something isn't working label Jan 31, 2023
@bwindels bwindels changed the title Fix back-filling spinning indefinitely Fix timeline back-filling spinning indefinitely Jan 31, 2023
@bwindels
Copy link
Contributor Author

There's a few things wrong here:

  • this error should not create an infinite loop
  • this error should be reported in the UI of the RoomViewModel (or TimelineViewModel?)
  • we can prevent the error from happening in the first place by keeping the token in memory between when we start the request and when we process the response, rather than relying on the start value provided by the server. This seems to happen because synapse added a field to the pagination tokens, so they support the old format but will return tokens with the added field, hence _0 being appeneded.

@bwindels
Copy link
Contributor Author

Exception ftr:

Error: start is not equal to prev_batch or next_batch
    writeFragmentFill GapWriter.js:178
    fillGap BaseRoom.js:353
    run LogItem.ts:192
    _run Logger.ts:110
    run Logger.ts:80
    wrapOrRun Logger.ts:54
    fillGap BaseRoom.js:312
    fill GapTile.js:44
    notifyVisible GapTile.js:80
    _setVisibleTileRange TimelineViewModel.js:76
    setVisibleTileRange TimelineViewModel.js:60
    promise callback*setVisibleTileRange TimelineViewModel.js:59
    updateVisibleRange TimelineView.ts:183
    restoreScrollPosition TimelineView.ts:134
    tilesView TimelineView.ts:78
    onUpdate TimelineView.ts:220
    emitUpdate BaseObservableList.ts:54
    _emitSpontanousUpdate TilesCollection.js:46
    emitChange SimpleTile.js:100
    fill GapTile.js:65
ConsoleReporter.ts:63:20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant