Skip to content

Conversation

@AntoLC
Copy link
Collaborator

@AntoLC AntoLC commented Dec 12, 2025

Purpose

We observe some throttling pick here and there.
We observed that when the collaboration has a problem, it is retrying to connect, leading to more requests to the django backend. At one point, the throttling is reached and the user would not be able to use the application anymore.

Proposal

Now when the request comes from a collaboration server, we do not throttle it anymore.

To do so we add the Y_PROVIDER_API_KEY in the request coming from the collaboration server.

const response = await axios.get<T>(
    `${COLLABORATION_BACKEND_BASE_URL}${path}`,
    {
      headers: {
        cookie: requestHeaders['cookie'],
        origin: requestHeaders['origin'],
        'X-Y-Provider-Key': Y_PROVIDER_API_KEY,
      },
    },
  );

We observe some throttling pick here and there.
We observed that when the collaboration has a
problem, it is retrying to connect, leading to more
requests to the django backend. At one point, the
throttling is reached and the user would not
be able to use the application anymore.
Now when the request comes from a collaboration
server, we do not throttle it anymore.
@AntoLC AntoLC force-pushed the enhance/throttle-from-collab branch from 7371697 to 2d803f9 Compare December 12, 2025 08:24
@AntoLC AntoLC requested a review from lunika December 12, 2025 08:24
factories.UserDocumentAccessFactory(document=document, user=user)

# Make many requests with the y-provider API key
for _i in range(100):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can test with 10 ? To save time in the test suite

f"/api/v1.0/documents/{document.id!s}/",
)
assert response.status_code == 429

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can maybe here make a new request using the special header to test that this one will not be throttled ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants