reduce comment depth, add docs

This commit is contained in:
Felix Ableitner 2024-09-10 17:20:12 +02:00
parent 3f8c998170
commit e0687bd585
3 changed files with 8 additions and 8 deletions

3
Cargo.lock generated
View file

@ -17,7 +17,8 @@ checksum = "8f27d075294830fcab6f66e320dab524bc6d048f4a151698e153205559113772"
[[package]]
name = "activitypub_federation"
version = "0.5.8"
source = "git+https://github.com/LemmyNet/activitypub-federation-rust.git?branch=nested-comments-stack-overflow#4b94af9ea0580226aaa10a4abb004d0b8ca10eae"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b86eea7a032da501fe07b04a83c10716ea732c45e6943d7f045bc053aca03f2a"
dependencies = [
"activitystreams-kinds",
"actix-web",

View file

@ -100,7 +100,7 @@ lemmy_db_views = { version = "=0.19.6-beta.7", path = "./crates/db_views" }
lemmy_db_views_actor = { version = "=0.19.6-beta.7", path = "./crates/db_views_actor" }
lemmy_db_views_moderator = { version = "=0.19.6-beta.7", path = "./crates/db_views_moderator" }
lemmy_federate = { version = "=0.19.6-beta.7", path = "./crates/federate" }
activitypub_federation = { git = "https://github.com/LemmyNet/activitypub-federation-rust.git", branch = "nested-comments-stack-overflow", default-features = false, features = [
activitypub_federation = { version = "0.5.8", default-features = false, features = [
"actix-web",
] }
diesel = "2.1.6"

View file

@ -860,16 +860,16 @@ test("Dont send a comment reply to a blocked community", async () => {
});
/// Fetching a deeply nested comment can lead to stack overflow as all parent comments are also
/// fetched recursively. Ensure that it works properly.
/// fetched recursively. Ensure that it works properly. Stack size depends on the OS so this
/// may fail in some cases. In release builds Lemmy is more optimized and can handle the max depth
/// of 100.
test("Fetch a deeply nested comment", async () => {
let lastComment;
for (let i = 0; i < 100; i++) {
let parent_id = lastComment?.comment_view.comment.id;
for (let i = 0; i < 80; i++) {
let commentRes = await createComment(
alpha,
postOnAlphaRes.post_view.post.id,
parent_id,
lastComment?.comment_view.comment.id,
);
expect(commentRes.comment_view.comment).toBeDefined();
lastComment = commentRes;
@ -880,7 +880,6 @@ test("Fetch a deeply nested comment", async () => {
lastComment!.comment_view.comment,
);
console.log(betaComment!.comment!.comment.path);
expect(betaComment!.comment!.comment).toBeDefined();
expect(betaComment?.comment?.post).toBeDefined();
});