Skip to content

API Request Flooding #155

@balakrishnadavath0305

Description

@balakrishnadavath0305

File: content.js
Cause: The extension sends an API request for every paragraph/span/text node, sequentially, even for large pages.
Consequences:
API throttling or blocking by Groq.
Laggy performance and potential browser freezing on large webpages.
Unpredictable user experience, especially on infinite scroll pages
Fix Recommendation: Implement Request Batching & Throttling
Here are 3 ways you can fix/improve it:
Option 1: Limit Elements Per Run
Limit translation to a certain number of elements per session:
const MAX_ELEMENTS = 50;

Option 2: Add Delay Between Calls
Throttle with setTimeout or a sleep() function:
await new Promise(resolve => setTimeout(resolve, 200));

Option 3: Use Promise.allSettled in Batches
Divide nodes into chunks and process them using Promise.allSettled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions