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

Deadlocking in update_positions count query #285

Closed
cmentch opened this issue Sep 26, 2017 · 7 comments
Closed

Deadlocking in update_positions count query #285

cmentch opened this issue Sep 26, 2017 · 7 comments
Assignees

Comments

@cmentch
Copy link

cmentch commented Sep 26, 2017

I have a larger database where I am using acts_as_list on various models. I have started seeing increased deadlocking on a specific count query. The stack dump revealed it was from the method "update_positions". This is being called from an after_update trigger on the model. Even if I am not updating the ordering column, this method is still firing off which seems unnecessary. Is there a need to trigger this even if the ordering column is not updated?

@brendon
Copy link
Owner

brendon commented Sep 26, 2017

Hi @cmentch, Thanks for picking this up. I've committed a change to master that checks if the position has changed first before going through with the callback. It tests out well locally, and let's see if the CI passes. Can you have a go using master and see if you get the deadlocks still?

@brendon
Copy link
Owner

brendon commented Sep 27, 2017

There was some trouble with Timecop. I think I've fixed it, so we'll see :)

@cmentch
Copy link
Author

cmentch commented Sep 27, 2017

Thank you for the quick response. I have pointed this to master in my Gemfile. It looks like it is no longer performing the count query when the ordering column is not updated. Perfect! I won't be able to try this out in production yet. When do you formally publish a new version of the gem?

@brendon
Copy link
Owner

brendon commented Sep 27, 2017

I'll just get @swanandp to take a quick look. @swanandp, I can't see any problems. The tests pass.

@brendon brendon self-assigned this Sep 27, 2017
@brendon
Copy link
Owner

brendon commented Sep 27, 2017

@cmentch, ping me back if we don't hear anything from @swanandp within a few days.

@swanandp
Copy link
Contributor

@brendon 75ec5b9

Looks good. 👍

@brendon
Copy link
Owner

brendon commented Sep 28, 2017

Roger. I'll release a new version @cmentch :)

@brendon brendon closed this as completed Sep 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants