-
Notifications
You must be signed in to change notification settings - Fork 216
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
Duplicates (race condition) #127
Comments
Could throw the vote in a background job and put a delay on it for a second. Edit: really hacky but it'd do the job. |
Maybe just disable the vote button with js when clicked. |
@floydback You will definitely need a unique key if your business needs the user to vote only once. You should add a database constraint + rails validations of course and handle the user already voted scenario in you client. |
@laertispappas Yes! |
@floydback I am not sure I do understand you. At the time being as far as I know and based on the migration template no constraint is added. I think there should be one since it doesn't make sense to have multiple votes per option. |
@laertispappas Yes you are right. I have added a unique key to DB manually and it's work. Sorry for my English. All I want to say is when I installed this gem I expected migration file has some code like this: |
@floydback Agree with you but this depends on the application. Maybe there are applications that do need to have multiple votes (although I can't find a use case). +1 for your suggestion. By the way is you're application public? Could I have a look since I am interested? |
Just chiming in here: Allowing users to vote on specific features is one of
the ways I have seen the "multiple votes per *thing *per *user*"
implemented. UserVoice is an example, though I suspect they might have a
`value` column on a record to indicate how many "votes" or "points" were
awarded to an individual *thing* from a specific user.
…On Thu, Sep 7, 2017 at 3:16 AM, Laertis ***@***.***> wrote:
@floydback <https://github.com/floydback> Agree with you but this depends
on the application. Maybe there are applications that do need to have
multiple votes (although I can't find a use case). +1 for your suggestion
though.
By the way is you're application public? Could I have a look since I am
interested?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#127 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB7ykLwy0x10Zr1LJx61Nyj7_zs5r5ttks5sf6ZXgaJpZM4F-PAC>
.
--
Hello from Minneapolis Josh Brody (952) 239-7408 www
<http://www.josh.mn>
|
Hi!
In my project users votes every day a lot (about ~5000 votes). User can voted for post only one time.
So, I have a simple code
But. I've find duplicates in votes table. One user voted two or more times for the same post.
I think it's happened when the server is overloaded and user send two or more times one http request in a short time.
How to prevent this? I think about
The text was updated successfully, but these errors were encountered: