Skip to content

Revamp the SyncUntil API #271

@kegsay

Description

@kegsay

There's now a good number of use cases for a better version of SyncUntil and friends. As of #267 we now have:

  • SyncUntilTimelineHas
  • SyncUntilGlobalAccountDataHas
  • SyncUntilInvitedTo

which all call SyncUntil with varying parameters. Using functional options here (like client.MustDoFunc) seems like the obvious solution. This also allows both timeline/account data to be checked in a single go, etc. By doing this, we can also adjust the thing we are looping over (obviating the need for things like #245 and #246).

In terms of since token handling (e.g #247), it's a lot clearer in tests if the token is returned to the caller rather than side-effected on the client. Consider:

alice := deployment.Client("alice", "hs1")
postInviteToken := alice.SyncUntil(...get invited)
alice.JoinRoom(...)
postJoinToken := alice.SyncUntil(postInviteToken, ...get join)

This gives flexibility to start from an initial sync or do an incremental sync.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions