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

unlock method returns NoMethodError: undefined method `[]' for false:FalseClass #109

Open
Hammam94 opened this issue May 17, 2022 · 1 comment

Comments

@Hammam94
Copy link

Hammam94 commented May 17, 2022

the unlock method returns NoMethodError: undefined method '[]' for false:FalseClass

my code
lock_manager = Redlock::Client.new(REDIS_LOCKING[:servers])
lock_info = lock_manager.lock(retailer_id.to_s, REDIS_LOCKING[:ttl])
.....
lock_manager.unlock(lock_info)


error from sentry

Screen Shot 2022-05-17 at 10 53 16 AM

@leandromoreira
Copy link
Owner

Hey @Hammam94 I think it's because your fist attempt to acquire the lock have failed.

lock_manager = Redlock::Client.new(REDIS_LOCKING[:servers])
lock_info = lock_manager.lock(retailer_id.to_s, REDIS_LOCKING[:ttl])

# your lock_info might be `false` instead of `{validity: 1987, resource: "resource_key", value: "generated_uuid4"}`
.....
lock_manager.unlock(lock_info)

You can not assume that you will get lock in any point.

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