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

Force unlock #15

Closed
BrandonCopley opened this issue Nov 7, 2015 · 7 comments
Closed

Force unlock #15

BrandonCopley opened this issue Nov 7, 2015 · 7 comments
Assignees

Comments

@BrandonCopley
Copy link

I would like to be able to force an unlock even if I don't know the id, is this possible?

@TheDeveloper
Copy link
Owner

Hi Brandon,

By design only the owner of the lock should be able to release it. I'm dubious that any other pattern is appropriate but I would like to hear why you feel this is necessary?

@TheDeveloper TheDeveloper self-assigned this Nov 9, 2015
@BrandonCopley
Copy link
Author

One problem I have is rebooting the server. On reboot the function is still
locked out, even though it's clearly not running.

On Monday, November 9, 2015, Geoff Wagstaff notifications@github.com
wrote:

Hi Brandon,

By design only the owner of the lock should be able to release it. I'm
dubious that any other pattern is appropriate but I would like to hear why
you feel this is necessary?


Reply to this email directly or view it on GitHub
#15 (comment)
.

[image: Giftnix]

Brandon Copley

Founder & CEO

t: 512.784.6060

e: copley.brandon@gmail.com

@TheDeveloper
Copy link
Owner

Ideally, your process would have some sort of shut down procedure where it finishes its work and releases the lock before exiting. I appreciate that this isn't always possible though.

Other than that, you can rely on the lock timeouts to release the lock so that when your app boots up again it can eventually obtain the lock.

@calibr
Copy link
Contributor

calibr commented Jan 2, 2016

Hello, I think it would be usefull feature for some cases if warlock returns the lock id in .lock callback. For example, In our system we are going to develop such workflow for collaborative text editor:

  • User starts to edit a text and client sends to server command(http request or websocket request) to lock the text and receives the lock id
  • Another user can't edit the same text at the same time with first user, because it's exclusively locked
  • When first user finishes editing client sends command to unlock it and from that moment second user becomes able to edit the text

So for this flow the lock TTL depends on how long first user will interact with text via client GUI and when it finishes we need to release the lock immediately.

@TheDeveloper
Copy link
Owner

Hi @calibr, thank you for detailing that use case. It makes sense to know the lock ID there. Perhaps it could be set as a property of the unlock function, or passed as an additional argument to the lock callback.

@calibr
Copy link
Contributor

calibr commented Jan 4, 2016

thanks, I'm going to submit a pull request for this in few days

@TheDeveloper
Copy link
Owner

@calibr that would be much appreciated 👍

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