Skip to content

v5 sync takes 5s when no new events #402

@Batmaev

Description

@Batmaev

When I open Element X, it says "Sync..." for around 5s.

Investigation

curl -s -X POST "http://localhost:8008/_matrix/client/unstable/org.matrix.simplified_msc3575/sync?timeout=0" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -d '{"lists":{}}'

# timeout=0    -> Returns in 5s
# timeout=100  -> Returns in 5s
# timeout=6000 -> Returns in 6s
# timeout none -> Returns in ~12ms
#
# same empty {"pos":"..."} response

When using v3 (curl -s "http://localhost:8008/_matrix/client/v3/sync?timeout=100" -H "Authorization: Bearer $TOKEN"), it returns in ~12ms. Probably v3 checks for additional types of events -> they are present -> no waiting.

Conclusion: sync ignores the timeout parameter if it is less than 5s.

Environment: tuwunel v1.5.1, Element Pro v26.03.3 (61)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions