Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create helper function to fetch data with concurrent requests #1954

Merged
merged 2 commits into from
Mar 5, 2024

Conversation

mkholjuraev
Copy link
Contributor

This adds a simple, but useful helper function to utils package. It will help us to fetch a huge amount of data using paginated requests. Additionally, those paginated requests can be done in a certain number of concurrent API calls.

Copy link
Contributor

@Hyperkid123 Hyperkid123 left a comment

Choose a reason for hiding this comment

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

Do we need the p-all and p-map dependency? In this case, we are dealing with just a simple que.

I am also a bit curious about why you need to limit the number of concurrent requests at all?

@mkholjuraev
Copy link
Contributor Author

mkholjuraev commented Jan 9, 2024

@Hyperkid123 thank you for having a look. I think they will be useful to avoid AKAMAI blocks when there are 10k items to be fetched. As you know if we do not limit concurrent requests, AKAMAI will block after a short time. Let me know if this is not needed. BTW, I writing tests

@Hyperkid123
Copy link
Contributor

I think they will be useful to avoid AKAMAI blocks when there are 10k items to be fetched.

Oh, one more question. Why is it that the UI requires 10k of records? Rendering anything with 10k items (table for example) is never going to end up with good UX unless the view is virtualized.

@mkholjuraev
Copy link
Contributor Author

mkholjuraev commented Jan 9, 2024

Yup, this is one of the major issues on the UI that we face. When for example, a customer selects all existing advisories to be remediated, there is too much data to be fetched on the frontend to make it available for remediation app. Another example is when customers export reports. Maybe, I am exaggerating a bit, but I have seen sometimes this indeed happens. At the same time, I should mention that no table or UI component deals with so much data on the UI

@mkholjuraev
Copy link
Contributor Author

The ideal solution for the remediation issue would be to do changes in the architectural level, but it is requires a decent amount of effort. Discussions on this have been taken place even now.

@Hyperkid123
Copy link
Contributor

Hyperkid123 commented Jan 9, 2024

The ideal solution for the remediation issue would be to do changes in the architectural level, but it is requires a decent amount of effort. Discussions on this have been taken place even now.

Yeah, I think the screens should be revisited then. I am not going to block your features, but I'd like it if the problem was properly sorted out at some point. These kinds of "optimizations" should never be required.

If you need any help, let me know.

@Hyperkid123 Hyperkid123 added the release Once merged it will trigger bugfix release label Jan 9, 2024
@bastilian
Copy link
Member

bastilian commented Jan 10, 2024

@Hyperkid123 One main area that we have been using these hooks or similar solutions are exports, like CSV, JSON and PDF. Another one is when we do batch actions, and we require data that needs to be submitted to an API later on, like a list of all host IDs.

@mkholjuraev
Copy link
Contributor Author

@Hyperkid123 just wanted to remind you about this.

@Hyperkid123
Copy link
Contributor

Hyperkid123 commented Jan 30, 2024

@mkholjuraev the CI is still failing.

EDIT: Oh I see. I restarted the job. See if its happy now or we need some adjustment.

@Hyperkid123
Copy link
Contributor

@mkholjuraev you did not push the lock file changes hence the CI failure

npm ERR! code EUSAGE
npm ERR! 
npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm ERR! 
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file

@mkholjuraev
Copy link
Contributor Author

@Hyperkid123 fixed. PTAL

@mkholjuraev mkholjuraev requested a review from a team February 5, 2024 13:10
Copy link
Contributor

@gkarat gkarat left a comment

Choose a reason for hiding this comment

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

LGTM. I think we can merge and release it now

Copy link
Contributor

@gkarat gkarat left a comment

Choose a reason for hiding this comment

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

Oops, there are some conflicts. Can we resolve them? @mkholjuraev otherwise, everything looks good

@mkholjuraev
Copy link
Contributor Author

@gkarat thanks for having a look. Conflicts are resolved now

@mkholjuraev mkholjuraev requested a review from gkarat March 4, 2024 15:39
@mkholjuraev mkholjuraev merged commit 5f0c903 into RedHatInsights:master Mar 5, 2024
1 check passed
@gkarat gkarat added the utils update to utils package label Mar 27, 2024
@Hyperkid123 Hyperkid123 removed the release Once merged it will trigger bugfix release label Mar 28, 2024
@Hyperkid123 Hyperkid123 added the release Once merged it will trigger bugfix release label Mar 28, 2024
@nacho-bot
Copy link
Collaborator

                      :soon::shipit::octocat:
     :bug:Shipit Squirrel has this release bugfix surrounded, be ready for a new version:beetle:

@nacho-bot
Copy link
Collaborator

     🌱 🌸 🌷 🌻 🌟 New version of package has been released 🌟 🌻 🌷 🌸 🌱

                The release is available on:

        :package:@redhat-cloud-services/frontend-components-utilities/v/4.0.8📦

             :boom:This feature is brought to you by probot🚀

@nacho-bot nacho-bot added the released Pr has been released label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release Once merged it will trigger bugfix release released Pr has been released utils update to utils package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants