Update FakeChannel.await_result(...) to drive async Rust (Tokio runtime/thread pool)#19879
Update FakeChannel.await_result(...) to drive async Rust (Tokio runtime/thread pool)#19879MadLittleMods wants to merge 9 commits into
FakeChannel.await_result(...) to drive async Rust (Tokio runtime/thread pool)#19879Conversation
Split off from #19878
FakeChannel.await_result(...) changes on their ownFakeChannel.await_result(...) changes to drive async Rust on their own
Same thing we did in #19871
…Case_new.test_wait_for_sync_token`
| # `notifier.wait_for_stream_token(from_token)` only checks every 500ms so we | ||
| # need to match that in order to make sure we hit the wake-up for sure. | ||
| channel.await_result(timeout_ms=500) |
There was a problem hiding this comment.
Previously, this worked because await_result(...) would advance 0.1s past the specified timeout_ms and I guess that worked out to hit the 500ms notifier.wait_for_stream_token(from_token) check interval every time.
Now await_result(...) can timeout when we exactly hit the timeout_ms so we weren't hitting it.
I've updated the second wait to be 500ms to match notifier.wait_for_stream_token(from_token) so we know that we can always hit the interval regardless of the current Twisted clock time.
FakeChannel.await_result(...) changes to drive async Rust on their ownFakeChannel.await_result(...) and friends to drive async Rust (Tokio runtime/thread pool)
| @@ -0,0 +1 @@ | |||
| Update `HomeserverTestCase.get_success(...)` and friends to drive async Rust (Tokio runtime/thread pool). | |||
| # TODO: Why? | ||
| self._reactor.run() |
There was a problem hiding this comment.
Prior art. Something to figure out in a future PR. Just noting that I don't know. The reactor should already be running and we can potentially remove it in another PR.
| @@ -301,15 +302,85 @@ def transport(self) -> "FakeChannel": | |||
| def await_result(self, timeout_ms: int = 1000) -> None: | |||
There was a problem hiding this comment.
Similar structure to what we've done in #19871
FakeChannel.await_result(...) and friends to drive async Rust (Tokio runtime/thread pool)FakeChannel.await_result(...) to drive async Rust (Tokio runtime/thread pool)
Update
FakeChannel.await_result(...)to drive async Rust (Tokio runtime/thread pool)Split off from #19878 (needed to drive requests in tests that use async Rust)
Follow-up to #19871
Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.