From a10bf7d4104ea433156a6c17a72dda8c0ea9673e Mon Sep 17 00:00:00 2001 From: Nutomic Date: Tue, 22 Mar 2022 18:40:40 +0000 Subject: [PATCH 1/3] Adjust retry interval for sending activities (#2141) --- crates/apub_lib/src/activity_queue.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/apub_lib/src/activity_queue.rs b/crates/apub_lib/src/activity_queue.rs index ca8645cb..a94229ff 100644 --- a/crates/apub_lib/src/activity_queue.rs +++ b/crates/apub_lib/src/activity_queue.rs @@ -72,8 +72,19 @@ impl ActixJob for SendActivityTask { type Future = Pin>>>; const NAME: &'static str = "SendActivityTask"; + /// With these params, retries are made at the following intervals: + /// 3s + /// 9s + /// 27s + /// 1m 21s + /// 4m 3s + /// 12m 9s + /// 36m 27s + /// 1h 49m 21s + /// 5h 28m 3s + /// 16h 24m 9s const MAX_RETRIES: MaxRetries = MaxRetries::Count(10); - const BACKOFF: Backoff = Backoff::Exponential(2); + const BACKOFF: Backoff = Backoff::Exponential(3); fn run(self, state: Self::State) -> Self::Future { Box::pin(async move { do_send(self, &state.client).await }) From 5698dd77710ab62711f3fa80bf4b3257e902e4cb Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 22 Mar 2022 15:50:47 -0400 Subject: [PATCH 2/3] Trying to fix api tests 1 --- api_tests/src/comment.spec.ts | 5 +++-- api_tests/src/post.spec.ts | 12 +++--------- api_tests/src/shared.ts | 7 +++++++ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/api_tests/src/comment.spec.ts b/api_tests/src/comment.spec.ts index 55d0c5d4..314f18ec 100644 --- a/api_tests/src/comment.spec.ts +++ b/api_tests/src/comment.spec.ts @@ -23,6 +23,7 @@ import { listCommentReports, randomString, API, + unfollows, } from './shared'; import { CommentView } from 'lemmy-js-client'; @@ -32,6 +33,7 @@ let postRes: PostResponse; beforeAll(async () => { await setupLogins(); + await unfollows(); await followBeta(alpha); await followBeta(gamma); let betaCommunity = (await resolveBetaCommunity(alpha)).community; @@ -42,8 +44,7 @@ beforeAll(async () => { }); afterAll(async () => { - await unfollowRemotes(alpha); - await unfollowRemotes(gamma); + await unfollows(); }); function assertCommentFederation( diff --git a/api_tests/src/post.spec.ts b/api_tests/src/post.spec.ts index 3e834dbe..0e9276f9 100644 --- a/api_tests/src/post.spec.ts +++ b/api_tests/src/post.spec.ts @@ -29,7 +29,8 @@ import { randomString, registerUser, API, - getSite + getSite, + unfollows } from './shared'; import { PostView, CommunityView } from 'lemmy-js-client'; @@ -46,13 +47,6 @@ afterAll(async () => { await unfollows(); }); -async function unfollows() { - await unfollowRemotes(alpha); - await unfollowRemotes(gamma); - await unfollowRemotes(delta); - await unfollowRemotes(epsilon); -} - function assertPostFederation(postOne: PostView, postTwo: PostView) { expect(postOne.post.ap_id).toBe(postTwo.post.ap_id); expect(postOne.post.name).toBe(postTwo.post.name); @@ -400,4 +394,4 @@ test('Report a post', async () => { expect(betaReport.original_post_url).toBe(alphaReport.original_post_url); expect(betaReport.original_post_body).toBe(alphaReport.original_post_body); expect(betaReport.reason).toBe(alphaReport.reason); -}); \ No newline at end of file +}); diff --git a/api_tests/src/shared.ts b/api_tests/src/shared.ts index da606b1f..4f305237 100644 --- a/api_tests/src/shared.ts +++ b/api_tests/src/shared.ts @@ -653,3 +653,10 @@ export function randomString(length: number): string { } return result; } + +export async function unfollows() { + await unfollowRemotes(alpha); + await unfollowRemotes(gamma); + await unfollowRemotes(delta); + await unfollowRemotes(epsilon); +} From 500ca158935b71f3f7cd4f83a50c850538b2ef4a Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 22 Mar 2022 18:06:59 -0400 Subject: [PATCH 3/3] Trying to fix api tests 2 --- api_tests/src/post.spec.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/api_tests/src/post.spec.ts b/api_tests/src/post.spec.ts index 0e9276f9..f545754f 100644 --- a/api_tests/src/post.spec.ts +++ b/api_tests/src/post.spec.ts @@ -285,14 +285,6 @@ test('Search for a post', async () => { expect(betaPost.post.name).toBeDefined(); }); -test('A and G subscribe to B (center) A posts, it gets announced to G', async () => { - let postRes = await createPost(alpha, betaCommunity.community.id); - expect(postRes.post_view.post).toBeDefined(); - - let betaPost = (await resolvePost(gamma, postRes.post_view.post)).post; - expect(betaPost.post.name).toBeDefined(); -}); - test('Enforce site ban for federated user', async () => { // create a test user let alphaUserJwt = await registerUser(alpha); @@ -378,6 +370,15 @@ test('Enforce community ban for federated user', async () => { expect(searchBeta2.posts[0]).toBeDefined(); }); + +test('A and G subscribe to B (center) A posts, it gets announced to G', async () => { + let postRes = await createPost(alpha, betaCommunity.community.id); + expect(postRes.post_view.post).toBeDefined(); + + let betaPost = (await resolvePost(gamma, postRes.post_view.post)).post; + expect(betaPost.post.name).toBeDefined(); +}); + test('Report a post', async () => { let betaCommunity = (await resolveBetaCommunity(beta)).community; let postRes = await createPost(beta, betaCommunity.community.id);