From 2bd3a8f021f1f2a74deb79f624a6d4e952eb0818 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 6 Jul 2019 23:20:43 -0700 Subject: [PATCH] modules/client/sync/rooms/ephemeral/receipt: Make the search depth a conf item. --- modules/client/sync/rooms/ephemeral/receipt.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/client/sync/rooms/ephemeral/receipt.cc b/modules/client/sync/rooms/ephemeral/receipt.cc index 0a07ee4d8..19783961f 100644 --- a/modules/client/sync/rooms/ephemeral/receipt.cc +++ b/modules/client/sync/rooms/ephemeral/receipt.cc @@ -16,6 +16,8 @@ IRCD_MODULE namespace ircd::m::sync { + extern conf::item receipt_scan_depth; + static bool _handle_message_receipt(data &, const m::event &); static bool _handle_message(data &, const m::event::idx &); static bool room_ephemeral_m_receipt_m_read_polylog(data &); @@ -31,6 +33,13 @@ ircd::m::sync::room_ephemeral_m_receipt_m_read room_ephemeral_m_receipt_m_read_linear }; +decltype(ircd::m::sync::receipt_scan_depth) +ircd::m::sync::receipt_scan_depth +{ + { "name", "ircd.client.sync.rooms.ephemeral.receipt_scan_depth" }, + { "default", 10L }, +}; + bool ircd::m::sync::room_ephemeral_m_receipt_m_read_linear(data &data) { @@ -89,7 +98,7 @@ ircd::m::sync::room_ephemeral_m_receipt_m_read_polylog(data &data) ssize_t i(0); event::idx idx(0); - for(; it && i < 10; --it) + for(; it && i < receipt_scan_depth; --it) { if(apropos(data, it.event_idx())) {