Limit recent events when going backwards (#2840)
Limit recent events when going backwards (#2840)

If we're going backwards, we were selecting potentially thousands of
events, which in turn were fed to history visibility checks, resulting
in bad sync performance.
matrix-org/dendrite,matrix-org/dendrite,matrix-org/dendrite,matrix-org/dendrite