Skip to content

Fix #1397: Implement batching and error handling for bulkUpdate to pr…#1614

Open
shabnam311 wants to merge 1 commit into
aryandas2911:mainfrom
shabnam311:fix/bulk-update-ddos
Open

Fix #1397: Implement batching and error handling for bulkUpdate to pr…#1614
shabnam311 wants to merge 1 commit into
aryandas2911:mainfrom
shabnam311:fix/bulk-update-ddos

Conversation

@shabnam311

Copy link
Copy Markdown
Contributor

Description

This PR resolves #1397, addressing the critical architecture flaw in the bulkUpdate hook which fired unbounded, concurrent API requests, causing rate limiting and permanent UI desyncs upon partial failure.

Changes Made

  • Request Batching: Refactored bulkUpdate in useTasks.js to process requests in smaller chunks (batches of 5).
  • Graceful Error Handling: Switched from Promise.all to Promise.allSettled(). This guarantees that if one single request within the batch fails (e.g., due to a rate limit or validation error), it will no longer trigger an unhandled promise rejection that crashes the entire operation.
  • State Synchronization: Wrapped the entire loop in a try...finally block. This guarantees that await getTasks(page) is always executed regardless of partial failures, ensuring the UI reliably synchronizes with the true backend state.

Testing

  • Selected a large number of tasks (e.g., 20+) to bulk edit.
  • Simulated a network error/rejection on one of the tasks mid-process.
  • Verified that the system successfully completed the rest of the requests, caught the error gracefully, and properly refreshed the UI state with the final accurate data.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Architecture] bulkUpdate initiates a client-side self-DDoS attack by firing unbounded concurrent API requests

1 participant