ClosureTree/with_advisory_lock

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

jturkel opened this issue · 1 comments

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.

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