mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:56:06 -04:00
Ensure that we do not cache empty sync responses after a timeout (#10158)
Fixes #8518 by telling the ResponseCache not to cache the /sync response if the next_batch param is the same as the since token.
This commit is contained in:
parent
9cf6e0eae7
commit
fcf3c7032b
8 changed files with 84 additions and 21 deletions
|
@ -138,21 +138,19 @@ class FakeChannel:
|
|||
def transport(self):
|
||||
return self
|
||||
|
||||
def await_result(self, timeout: int = 100) -> None:
|
||||
def await_result(self, timeout_ms: int = 1000) -> None:
|
||||
"""
|
||||
Wait until the request is finished.
|
||||
"""
|
||||
end_time = self._reactor.seconds() + timeout_ms / 1000.0
|
||||
self._reactor.run()
|
||||
x = 0
|
||||
|
||||
while not self.is_finished():
|
||||
# If there's a producer, tell it to resume producing so we get content
|
||||
if self._producer:
|
||||
self._producer.resumeProducing()
|
||||
|
||||
x += 1
|
||||
|
||||
if x > timeout:
|
||||
if self._reactor.seconds() > end_time:
|
||||
raise TimedOutException("Timed out waiting for request to finish.")
|
||||
|
||||
self._reactor.advance(0.1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue