Skip to content

_throttle does not flush #105

@jannschu

Description

@jannschu

Hi,

I debugged space rooms not loading in my case and I found an issue with _throttle in this case for the async stream:

Task { [weak self] in
for await state in paginateListener._throttle(for: .milliseconds(500)) {
self?.paginationState = state
}
}

It seems _throttle emits the first event right away and buffers elements arriving within the next 500ms. The problem seems to be that those are only flushed if now another element arrives or the base sequence finishes. In my case this reliably caused the loader to get stuck.

To confirm I temporarily removed the throttle there and also in LiveSpaceService.swift. I am not sure about the proper fix. I think the listener already receives batched updates and this probably happens infrequently, so maybe no throttle is needed?

edit: Maybe also worth looking into other places where _throttle is used?
edit2: In particular Mactrix/Models/LiveTimeline.swift, here I also saw partial timelines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions