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

Fixes inaccurate memberCount in Guilds and Parties - fixes #12286 #12885

Closed
wants to merge 4 commits into from

Conversation

lsophie
Copy link
Contributor

@lsophie lsophie commented Dec 15, 2020

Fixes #12286

Changes

Recomputes memberCount using mongoDB transactions each time it needs to be updated for both Parties and Guilds (was previously only done for Parties). This change is reflected in website/server/controllers/api-v3/groups.js.
Changes to .vue files were done automatically after running npm run lint.


UUID: ddd2399a-30f0-4b6a-a2f6-d6731f4621c7

…/leaves

The recomputation of memberCount in groups when a user joins/leaves it was currently only being done for Parties. I extended this functionality to Guilds as well, such that this recomputation now occurs for both Parties and Guilds.
group.memberCount += 1;
}
// Set group's new memberCount
const currentMembers = await group.getMemberCount();
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @lsophie , thanks for the PR. I'm a bit confused about the PR because group.getMemberCount() is not currently using transactions, it's manually counting documents from the database. The idea to fix this issue is to remove group.getMemberCount() and instead wrap the code in these routes in a mongodb transactions to make sure the group is always updated correctly. See https://mongoosejs.com/docs/transactions.html for a guide on how to use transactions

@SabreCat
Copy link
Member

Closing this PR as abandoned. @lsophie, if you end up circling back to this, please comment on the associated issue ticket noting that you're taking it up!

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

Successfully merging this pull request may close these issues.

Member count inaccurate in Guilds and Parties
3 participants