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

with_advisory_lock doesn't work on Postgres with string lock names with MRI 1.9 #5

Closed
jturkel opened this issue Mar 21, 2013 · 1 comment

Comments

@jturkel
Copy link
Contributor

jturkel commented Mar 21, 2013

On Postgres with_advisory_lock converts non-numeric lock names to integers by converting the lock name to a string and then computing the hash of the string. Unfortunately Ruby MRI 1.9 uses a session local random seed in the String hash method so hash codes will be different in different MRI instances. See this Stackoverflow question for more details. It looks like using Zlib.crc32 instead should do the trick.

jturkel added a commit to salsify/with_advisory_lock that referenced this issue Mar 21, 2013
@mceachen
Copy link
Collaborator

Thanks for the pull request! This is in v0.0.8

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

2 participants