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

refactor(migrate): acquire lock in a single statement #12

Merged

Conversation

mgartner
Copy link
Contributor

This can be accomplished in a single statement. UPDATE lock SET is_locked = true WHERE id = 'lock' and is_locked = false. You can tell if the unlock was successful by checking if any rows were updated.

@robinjoseph08
Copy link
Owner

nice! just so i understand, is the current way it's doing it problematic (i.e. causing a bug) or is this just a better way to do it since it's one query vs two?

@mgartner
Copy link
Contributor Author

There's no issues with the current way, just thought this was simpler.

Copy link
Owner

@robinjoseph08 robinjoseph08 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha! the change lgtm! im gonna update the pr title to be a refactor then since its not changing functionality and then ill cut a new version 👍

@robinjoseph08 robinjoseph08 changed the title feat(migrate): acquire lock in a single statement refactor(migrate): acquire lock in a single statement Dec 22, 2018
@robinjoseph08 robinjoseph08 merged commit 8848a30 into robinjoseph08:master Dec 22, 2018
@robinjoseph08
Copy link
Owner

v0.1.2 has been cut! thanks again!

@mgartner
Copy link
Contributor Author

thanks for your hospitality and happy holidays!

@mgartner mgartner deleted the acquire-lock-in-one-statement branch December 26, 2018 23:12
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

Successfully merging this pull request may close these issues.

2 participants