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

Accurate vote counts? #402

Open
HugoGresse opened this issue Feb 5, 2020 · 4 comments
Open

Accurate vote counts? #402

HugoGresse opened this issue Feb 5, 2020 · 4 comments
Assignees
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@HugoGresse
Copy link
Owner

After last changes, the count count should be the real count as the DB does the increment, not a cloud function.
To DO

  • setup 10 or so browser instances
  • check that all session has different user id
  • vote and unvote on many vote items randomly for 3 minutes
  • assert vote count should not be higher than 10
@HugoGresse HugoGresse added the question Further information is requested label Feb 5, 2020
@HugoGresse HugoGresse self-assigned this Feb 5, 2020
@HugoGresse
Copy link
Owner Author

As to current deployed version it is still not.
I'm currently refactoring the votes to fix this issue.

@HugoGresse
Copy link
Owner Author

I've tried to fix this using "Distributed counter" aka writing to separate document from a collection but It did not solve the issue. (see #416)
Status:

  • adding a lot of votes does not have any discrepancies between expected count and displayed counter after aggregation so this is good (in both production and with distributed counters)
  • issue appear when adding and then removing the votes, in both solutions
  • I did not test comments where this count be an issue but this has not been asserted.

The major issue for going to shard:

  • additional cost : more queries everywhere
  • more complexity overall
  • "live" mode seems very hard to implement in this solution
  • additional latency (really noticable) when displaying the vote count for every user due to additonal queries

So maybe the solution should be the "consolidate" the date on user request to fix the discrepancies. This seems more reasonable and the "dataConsolidation" branch has already been created though it's only a script and not a direct function callable by the user.

@HugoGresse HugoGresse changed the title Check vote counts is correct now Accurate vote counts? Feb 10, 2020
@HugoGresse
Copy link
Owner Author

@HugoGresse HugoGresse added the help wanted Extra attention is needed label Feb 10, 2020
@HugoGresse
Copy link
Owner Author

Other solution to investivate: FieldValue.increment https://firebase.google.com/docs/reference/js/firebase.firestore.FieldValue#increment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant