alephdata / aleph

Search and browse documents and data; find the people and companies you look for.
http://docs.aleph.occrp.org
MIT License
2k stars 267 forks source link

[Patch] BUG: Metadata API Request Error Handling / https://github.com/alephdata/aleph/issues/3812 / #3813

Open dimitardanailov opened 1 month ago

dimitardanailov commented 1 month ago

I'd like to share my proposal about the following issue: https://github.com/alephdata/aleph/issues/3812

The patch uses two different protection techniques.

#1 state. metadataRequestAttempts tracks how many attempts are requested to axios REST API layer. The current restrictions to const MAX_METADATA_REQUEST_ATTEMPTS = 5;

#2 executeRetryPattern uses setTimeout. setTimeout is going to be increased each time if the request has any error.

Accomplishments

#1 The previous version executed many request without any delay between requests.

Screenshot 2024-07-16 at 10 07 03 AM

#2 The gap between UI pop dialog is increased from a few ms to 2000+ ms.

Screenshot 2024-07-16 at 10 11 57 AM
dimitardanailov commented 1 month ago

Why the current pull request has a draft status ?

The main reason for that is: I've been working on different task. I've a plan to restructure the source code to add a state machine and code splitting between Happy and Unhappy path.

cc: @richardjennings-occrp

dimitardanailov commented 1 month ago

The current pull request migrates router structure from single "flat" file to folder structure with sub components and utils. The router component supports three different stats

cc: @tillprochaska and @richardjennings-occrp