Skip to content
Snippets Groups Projects
Commit 97fc6c15 authored by Jason Volk's avatar Jason Volk Committed by 🥺
Browse files

add edu select limit and condition for presence.


Signed-off-by: default avatarJason Volk <jason@zemos.net>
parent 6c9e95f7
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
pub mod send; pub mod send;
pub use send::FedDest; pub use send::FedDest;
const SELECT_EDU_LIMIT: usize = 16;
pub struct Service { pub struct Service {
db: &'static dyn Data, db: &'static dyn Data,
...@@ -514,6 +516,10 @@ pub fn select_edus_presence( ...@@ -514,6 +516,10 @@ pub fn select_edus_presence(
.unwrap_or_else(|| uint!(0)), .unwrap_or_else(|| uint!(0)),
status_msg: presence_event.content.status_msg, status_msg: presence_event.content.status_msg,
}); });
if presence_updates.len() >= SELECT_EDU_LIMIT {
break;
}
} }
let presence_content = Edu::Presence(PresenceContent::new(presence_updates)); let presence_content = Edu::Presence(PresenceContent::new(presence_updates));
...@@ -581,7 +587,7 @@ pub fn select_edus_receipts( ...@@ -581,7 +587,7 @@ pub fn select_edus_receipts(
events.push(serde_json::to_vec(&federation_event).expect("json can be serialized")); events.push(serde_json::to_vec(&federation_event).expect("json can be serialized"));
if events.len() >= 20 { if events.len() >= SELECT_EDU_LIMIT {
return Ok(false); return Ok(false);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment