From 5972f65cfb14d524b97f4322295c9778e3a0c7d6 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 6 Sep 2019 16:02:26 -0700 Subject: [PATCH] ircd::m::init::backfill: Skip backspill off prev events below the viewport depth. --- modules/m_init_backfill.cc | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/modules/m_init_backfill.cc b/modules/m_init_backfill.cc index e6d62b398..aa6e4126b 100644 --- a/modules/m_init_backfill.cc +++ b/modules/m_init_backfill.cc @@ -382,8 +382,30 @@ try pdus.at(0), event_id }; + const auto &[viewport_depth, _] + { + m::viewport(room_id) + }; + + const bool below_viewport + { + json::get<"depth"_>(event) < viewport_depth + }; + + if(below_viewport) + log::debug + { + log, "skipping acquired %s head %s depth:%ld below viewport:%ld", + string_view{room_id}, + string_view{event_id}, + json::get<"depth"_>(event), + viewport_depth, + }; + m::vm::opts vmopts; vmopts.infolog_accept = true; + vmopts.fetch_prev = !below_viewport; + vmopts.fetch_state = below_viewport; vmopts.warnlog &= ~vm::fault::EXISTS; vmopts.node_id = hint; m::vm::eval eval @@ -393,10 +415,11 @@ try log::info { - log, "acquired %s head %s depth:%zu", + log, "acquired %s head %s depth:%ld viewport:%ld", string_view{room_id}, string_view{event_id}, json::get<"depth"_>(event), + viewport_depth, }; return true;