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

[$50]Hundreds of resource api calls made on the dashboard page #4714

Open
SathyaJayabal opened this issue Aug 6, 2020 · 24 comments
Open

[$50]Hundreds of resource api calls made on the dashboard page #4714

SathyaJayabal opened this issue Aug 6, 2020 · 24 comments
Assignees
Labels
Beta Env Environment Dashboard Need clarification Need clarification to proceed fixing the issue further P4 Low (resolve within 2 weeks) tcx_Assigned v5-intgration-sub-code

Comments

@SathyaJayabal
Copy link
Collaborator

SathyaJayabal commented Aug 6, 2020

https://beta-community-app.topcoder.com/my-dashboard
Hundreds of resource api calls made on the dashboard page
Screenshot 2020-08-06 at 11 38 33 AM
dashboard (1).mp4.zip

@SathyaJayabal SathyaJayabal added P3 Normal (resolved within 7 days) Beta Env Environment Dashboard v5-intgration-sub-code P2 Important (resolve within 3 days) and removed P3 Normal (resolved within 7 days) labels Aug 6, 2020
@sushilshinde sushilshinde changed the title Hundreds of resource api calls made on the dashboard page [$50]Hundreds of resource api calls made on the dashboard page Aug 10, 2020
@crazyk07
Copy link

Contest https://www.topcoder.com/challenges/30136517 has been created for this ticket.

This is an automated message for crazyk via Topcoder X

@sushilshinde
Copy link
Collaborator

@topcoder-platform/topcodercompetitors @topcoder-platform/tcxcommunity this is open for pickup

Submit in 8 hours and PR to

https://github.com/topcoder-platform/community-app/tree/integration-v5-challenge-api
https://github.com/topcoder-platform/topcoder-react-lib/tree/integration-v5-challenge-api

run npm run test before PR

@sumitdaga sumitdaga self-assigned this Aug 10, 2020
@gets0ul gets0ul assigned gets0ul and unassigned sumitdaga Aug 10, 2020
@crazyk07
Copy link

Contest https://www.topcoder.com/challenges/30136517 has been updated - it has been assigned to daga_sumit.

This is an automated message for crazyk via Topcoder X

@crazyk07
Copy link

Contest https://www.topcoder.com/challenges/30136517 has been updated - it has been assigned to gets0ul.

This is an automated message for crazyk via Topcoder X

@gets0ul
Copy link
Collaborator

gets0ul commented Aug 10, 2020

Sorry @sumitdaga signed it first.

@gets0ul gets0ul removed their assignment Aug 10, 2020
@sumitdaga sumitdaga self-assigned this Aug 10, 2020
@crazyk07
Copy link

Contest https://www.topcoder.com/challenges/30136517 has been updated - it has been assigned to daga_sumit.

This is an automated message for crazyk via Topcoder X

@sumitdaga
Copy link
Contributor

thanks @gets0ul

@sumitdaga
Copy link
Contributor

sumitdaga commented Aug 10, 2020

@SathyaJayabal
The /resources/${memberId}/challenges endpoint is called without any filter here https://github.com/topcoder-platform/topcoder-react-lib/blob/integration-v5-challenge-api/src/services/members.js#L349
which returns all challenges for a member and not just the active challenges
and for some members, number of challenges they have registered to could be more than 1000

moreover i checked the resources api too ...it seems the filters (like status=Active) are not even implemented in the api
https://github.com/topcoder-platform/resources-api/blob/develop/src/services/ResourceService.js#L394

thanks

@SathyaJayabal
Copy link
Collaborator Author

@sumitdaga , Please use the challenge-api call that is used to populate the my challenges bucket in the challenge listings page.

cc @sushilshinde, please confirm if this approach is fine?

@sumitdaga
Copy link
Contributor

sumitdaga commented Aug 10, 2020

@SathyaJayabal
ok so with the above call, that is, /resources/${memberId}/challenges, we are just getting the role of the user in their active challenges and we already have roles (this is an array compared to a single value from the resources api) from here https://github.com/topcoder-platform/community-app/blob/integration-v5-challenge-api/src/shared/components/Dashboard/CurrentActivity/Challenges/ChallengeCard/index.jsx#L76
which infact comes from the same api which is used in challenge listing page

so in essence we don't even need to call this /resources/${memberId}/challenges api at all, as we already have the roles info.
I am not sure if all the roles a user has in that challenge need to be shown or just any one of the roles, in the challenge card on the dashboard.

@sushilshinde
Copy link
Collaborator

@sumitdaga

https://api.topcoder.com/v5/challenges/?status=Active&memberId=40623428&perPage=99&page=1

Returns all dashboard required challenges, we don't need resources calls here

@cagdas001 cagdas001 self-assigned this Aug 11, 2020
@crazyk07
Copy link

Contest https://www.topcoder.com/challenges/30136517 has been updated - it has been assigned to cagdas001.

This is an automated message for crazyk via Topcoder X

cagdas001 added a commit to cagdas001/topcoder-react-lib that referenced this issue Aug 12, 2020
At the `getUserResources` function, it will fetch only Active challenges.

Reference topcoder-platform/community-app#4714
@cagdas001
Copy link
Collaborator

PR: topcoder-platform/topcoder-react-lib#220

It will fetch only Active challenges

sushilshinde added a commit to topcoder-platform/topcoder-react-lib that referenced this issue Aug 13, 2020
@SathyaJayabal SathyaJayabal added this to the V5 Challenge API v1.1 milestone Aug 13, 2020
@SathyaJayabal
Copy link
Collaborator Author

This should also fix the issue of My Active cHallenges displaying all active challenges before displaying only My Challenges

@sushilshinde
Copy link
Collaborator

@cagdas001 https://test-community-app.topcoder-dev.com/my-dashboard

Still makes too many calls

@Oanh-and-only-Oanh Oanh-and-only-Oanh added P4 Low (resolve within 2 weeks) and removed P2 Important (resolve within 3 days) labels Aug 17, 2020
@cagdas001
Copy link
Collaborator

Still makes too many calls

@sushilshinde I have re-checked this. I'm only seeing a limited number of requests to /resources?challengeId= endpoint.

We need to make one request per challenge to get role details and this would be the minimum number of requests as per the API design. It doesn't allow to query multiple challenges at once, or to query the all of the resources user has

We need role details for the following field(s)
chrome_2020-08-18_07-04-10

So, some options:

  1. We can show only a limited number of challenges (for e.g. 20 challenges), and can add a View More button below.
  2. We can make a change at resources-api, in order to query multiple challengeIds at once, or to query ALL resources user (memberId) has.

This should also fix the issue of My Active cHallenges displaying all active challenges before displaying only My Challenges

@SathyaJayabal Could you elaborate this one a bit more, please? You mean it displays all the active challenges, instead of displaying the user's challenges?

@SathyaJayabal
Copy link
Collaborator Author

@cagdas001 , when we access the dashboard for the first time, we dont see the correct number of My Active Challenges. After refresh we see the correct number.
Screenshot 2020-08-18 at 9 56 09 AM
Screenshot 2020-08-18 at 9 56 32 AM

@SathyaJayabal
Copy link
Collaborator Author

@sushilshinde @cagdas001 , in production, a member will not have more than a few active challenges. So there will not be that many resource api calls, even if we call it once per challenge.

@sushilshinde Do you think we can go ahead with the above implementation?

@luizrrodrigues
Copy link
Collaborator

luizrrodrigues commented Sep 5, 2020

@SathyaJayabal I think this will be a problem with Admins/CA/CP because they is part of a lot of projects.

@luizrrodrigues
Copy link
Collaborator

@sushilshinde Need confirmation in this one. #4714 (comment)

@cagdas001 cagdas001 added Need clarification Need clarification to proceed fixing the issue further and removed tcx_Feedback tcx_ReadyForReview labels Sep 10, 2020
@Oanh-and-only-Oanh Oanh-and-only-Oanh modified the milestones: By 9/24/2020, Release by 10/8/2020 Sep 23, 2020
@SathyaJayabal SathyaJayabal removed this from the Release by 10/8/2020 milestone Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Beta Env Environment Dashboard Need clarification Need clarification to proceed fixing the issue further P4 Low (resolve within 2 weeks) tcx_Assigned v5-intgration-sub-code
Projects
None yet
Development

No branches or pull requests

8 participants