-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Member count inaccurate in Guilds and Parties #12286
Comments
With PR #12335 the Habitica codebase has been updated to support MongoDB 4.2 and transactions making it possible to fix this issue. Transactions allow operations on multiple documents to be executed ensuring that either all of them are executed correctly or none, making it possible to fix this issue. An example on using transactions can be found at https://mongoosejs.com/docs/transactions.html while more info at https://docs.mongodb.com/manual/core/transactions/. If you want to work on this issue and have any question please leave a comment! |
If you work on this the code used for guilds should also replace the existing one to make sure parties member count is accurate |
Hi, is this issue open to being worked on? If so, I'd love to pick it up! |
@lsophie it's available but since you already claimed another issue let's wait until that's done |
Hello, I'd love to take on this issue if it's still available! |
i'd like to work on this |
Sure thing, @Cred1Tor! |
i'm wondering what operations should be a part of a transaction? only where memberCount and user's membership are involved or everything else as well, like updating group plan, challenges, tasks etc? and in that case we'll also have to change some of the group schema methods' signatures to add a session as a parameter, bc some of the db operations happen there |
@Cred1Tor I'd suggest starting with the operations that update counts, because they've been thorns in our collective side for ages! And that's what's relevant to this specific issue ticket. There could definitely be other places where transactions would be beneficial, but let's get this piece done first. |
Can I work on this one? 😃 |
@antonderegt If you're feeling up to it, sure thing! 😁 |
Unfortunately I've not been able to fully fix the issue in a timely manner. Please see #14203 for a partial fix. The only tasks left are to create a new error message (for when the transaction is rolled back) and implementing the fix to all places where member count is changed. Good luck! |
@CuriousMagpie @SabreCat could I work on this if still a relavant issue |
Description
Clean-up of #7454. You can visit that ticket to see the full history of discussion on this issue.
Split off from #12275; that ticket can be addressed first.
memberCount
in group records is a stored computed value that we currently attempt to keep up to date by incrementing and decrementing as members join and leave. It frequently gets out of sync, leading to people needing to visit the Report a Bug Guild to have their Guild memberships updated.This is the desired fix:
However, this is likely to be performance-intensive under current Mongo functionality. This ticket will remain on hold until we can upgrade to a version that allows transactions, which will allow us to make a complete fix.
With PR #12335 the Habitica codebase has been updated to support MongoDB 4.2 and transactions making it possible to fix this issue.
Transactions allow operations on multiple documents to be executed ensuring that either all of them are executed correctly or none, making it possible to fix this issue.
An example on using transactions can be found at https://mongoosejs.com/docs/transactions.html while more info at https://docs.mongodb.com/manual/core/transactions/. If you want to work on this issue and have any question please leave a comment!
The text was updated successfully, but these errors were encountered: