Limit amount of HTTP requests to handle activities (fixes #1221) #117

Merged
dessalines merged 1 commits from request-limit into main 2020-10-26 15:35:41 +00:00
Owner

I tested this by using some different limits. With MAX_REQUEST_NUMBER=1, all the tests fail, as expected. MAX_REQUEST_NUMBER=5 is the lowest value where all the tests are passing.

I tested this by using some different limits. With `MAX_REQUEST_NUMBER=1`, all the tests fail, as expected. `MAX_REQUEST_NUMBER=5` is the lowest value where all the tests are passing.
dessalines reviewed 2020-10-26 14:10:18 +00:00
@ -48,0 +53,4 @@
async fn fetch_remote_object<Response>(
client: &Client,
url: &Url,
recursion_counter: &mut i32,
Owner

Might be better as an option, but this is fine.

Might be better as an option, but this is fine.
dessalines reviewed 2020-10-26 14:15:13 +00:00
@ -101,3 +101,3 @@
check_is_apub_id_valid(&actor_id)?;
let actor = get_or_fetch_and_upsert_actor(&actor_id, &context).await?;
let request_counter = &mut 0;
Owner

Something tells me there's a smart way to do this, by providing a None for the first fetch, then checking for a None and making it a zero, otherwise incrementing. But this works.

Something tells me there's a smart way to do this, by providing a `None` for the first fetch, then checking for a None and making it a zero, otherwise incrementing. But this works.
Author
Owner

Then we need to handle that in a lot more functions, here we only have to initialise the counter in 5 places iirc. Plus its easier to see where the counters are started.

Then we need to handle that in a lot more functions, here we only have to initialise the counter in 5 places iirc. Plus its easier to see where the counters are started.
dessalines merged commit 53c9094d46 into main 2020-10-26 15:35:41 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: LemmyNet/lemmy#117
No description provided.