From c63374849a4339be033731d3f8f82e72b4f69e5a Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 17 Aug 2019 04:02:00 -0700 Subject: [PATCH] modules/client/sync/rooms/ephemeral/receipt: Make ephemeral/receipt phase aware; no initial. --- modules/client/sync/rooms/ephemeral.cc | 5 ++++- modules/client/sync/rooms/ephemeral/receipt.cc | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/modules/client/sync/rooms/ephemeral.cc b/modules/client/sync/rooms/ephemeral.cc index 032b3281d..ec824d87b 100644 --- a/modules/client/sync/rooms/ephemeral.cc +++ b/modules/client/sync/rooms/ephemeral.cc @@ -27,7 +27,10 @@ ircd::m::sync::rooms_ephemeral { "rooms.ephemeral", rooms_ephemeral_polylog, - rooms_ephemeral_linear + rooms_ephemeral_linear, + { + { "phased", true } + } }; bool diff --git a/modules/client/sync/rooms/ephemeral/receipt.cc b/modules/client/sync/rooms/ephemeral/receipt.cc index 0b2d3f5d1..a876b6f88 100644 --- a/modules/client/sync/rooms/ephemeral/receipt.cc +++ b/modules/client/sync/rooms/ephemeral/receipt.cc @@ -30,7 +30,10 @@ ircd::m::sync::room_ephemeral_m_receipt_m_read { "rooms.ephemeral.m_receipt", room_ephemeral_m_receipt_m_read_polylog, - room_ephemeral_m_receipt_m_read_linear + room_ephemeral_m_receipt_m_read_linear, + { + { "phased", true } + } }; decltype(ircd::m::sync::receipt_scan_depth) @@ -90,10 +93,14 @@ ircd::m::sync::room_ephemeral_m_receipt_m_read_linear(data &data) bool ircd::m::sync::room_ephemeral_m_receipt_m_read_polylog(data &data) { - const m::room &room{*data.room}; + // With this sync::item being phased=true, this gets called for initial (zero) + // and all negative phases. We don't want to incur this load during initial. + if(data.phased && int64_t(data.range.first) == 0L) + return false; + m::room::messages it { - room + *data.room }; ssize_t i(0);