Skip to content

Need to implement an option on "/v5/groups" that returns all parent groups as well as groups the user is in #84

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

Closed
mtwomey opened this issue Apr 15, 2021 · 6 comments

Comments

@mtwomey
Copy link

mtwomey commented Apr 15, 2021

The most used call in groups API is plan old "/v5//groups/:groupId". This is because challenge-api needs to determine:

Step 1: Get all the groups the user directly belongs to (which is often > 1000).
Step 2: For each of those groups, get all the parent groups of that group
Step 3: Combine all these group IDs together

Step 2 makes a separate call for every group returned from Step 1, so a single call to challenge-api often results in over 1,000 calls to groups api:

3 Hour chart

image

2.3 Million calls to groups API in 3 hours due to this (this is typical across any 3 hours).

In challenge-api this process begins here: https://github.com/topcoder-platform/challenge-api/blob/1249f141c194229386f6bcf694fda138a9ca82ae/src/services/ChallengeService.js#L400

You can inspect the logic of exactly what it's doing by following helper.getCompleteUserGroupTreeIds

The suggested solution here is to implement a param such as /v5/groups?includeParentGroups=true which implements this logic so that it can be removed from challenge-api and handled in groups-api (via neo4j directly).

@bountyC0d3r
Copy link
Collaborator

this has been covered as a part of the groupeligibilitycheck end point

@lakshmiathreya
Copy link

lakshmiathreya commented Mar 8, 2022

cc @SathyaJayabal pls verify this and update QA status.

@SathyaJayabal SathyaJayabal reopened this Mar 9, 2022
@SathyaJayabal
Copy link
Collaborator

SathyaJayabal commented Mar 9, 2022

@dushyantb , the groupeligibilitycheck endpoint only returns a check:true/false . How do we get the list of groups the user has access to (including parent groups) ?
Do we use the groups/MemberGroups/{oldMemberId} endpoint instead? This returns the list of groups including the parent groups, but it returns only the list of old group ids. The challenge-api will need to make further calls to get additional data for each of those groups.

@rakibansary
Copy link
Contributor

Groups micro-service already has an Api that returns all the groups accessible by a member. It has now been updated to return UUIDs which can be used by Challenge Api to reduce number of Api calls to get a members accessible groups in this commit d1ff097

@SathyaJayabal
Copy link
Collaborator

verified on dev
using the uuid=true param
Screenshot 2022-03-21 at 10 56 23 AM
without the new param
Screenshot 2022-03-21 at 10 56 45 AM

@SathyaJayabal
Copy link
Collaborator

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

No branches or pull requests

5 participants