@@ -225,32 +225,25 @@ impl Db {
225225 budget : & mut ScanBudget ,
226226 ) -> Result < ( ThreadWindow , ReadSession ) > {
227227 let cursor = request. cursor . as_ref ( ) . map ( cursor_key) . transpose ( ) ?;
228- let ( path, predicate) = match ( request. direction , & cursor) {
229- // Even a freshly checked replica can miss a committed reply and
230- // sign a false exhausted newer page.
231- ( Direction :: Newer , _) => ( "thread_window_newer" , None ) ,
232- ( Direction :: Older , Some ( _) ) => (
233- "thread_window_cursor" ,
234- Some ( RoutePredicate :: from_channel_cursor (
235- request. channel ,
236- & cursor,
237- ) ) ,
238- ) ,
239- ( Direction :: Older , None ) => ( "thread_window_head" , Some ( RoutePredicate :: Bounded ) ) ,
228+ let path = match ( request. direction , cursor. is_some ( ) ) {
229+ ( Direction :: Newer , _) => "thread_window_newer" ,
230+ ( Direction :: Older , true ) => "thread_window_cursor" ,
231+ ( Direction :: Older , false ) => "thread_window_head" ,
240232 } ;
241- let decision = match predicate {
242- Some ( predicate) => Some (
233+ // Even a freshly checked replica can miss a committed reply and sign
234+ // a false exhausted newer page.
235+ let decision = if request. direction == Direction :: Older {
236+ Some (
243237 self . route_read (
244238 path,
245- predicate ,
239+ RoutePredicate :: from_channel_cursor ( request . channel , & cursor ) ,
246240 crate :: observability:: ReaderOperation :: SubscriptionHistory ,
247241 )
248242 . await ?,
249- ) ,
250- None => {
251- Self :: record_route ( path, "writer" , "newer_direction" ) ;
252- None
253- }
243+ )
244+ } else {
245+ Self :: record_route ( path, "writer" , "newer_direction" ) ;
246+ None
254247 } ;
255248 if let Some ( RouteDecision :: Replica ( mut tx, _, reason) ) = decision {
256249 let result = async {
0 commit comments