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
Adding skiplocked support #9197
Conversation
66597e1
to
dc700c5
Compare
You can add integration tests in this file
You can add an example of this option here If you want you can improve docs further as there is no dedicated section for locks, a subsection about locks in transaction docs will be really nice, but not required to merge this PR |
Great thanks. I'll take a look this weekend. |
b095143
to
26df8a5
Compare
Added tests and some simple docs |
test/integration/transaction.test.js
Outdated
return User.findAll({ | ||
limit: 1, | ||
lock: true, | ||
skipLocked: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In first transaction there is no need to skip locks, I assume all rows are free at this time.
test/integration/transaction.test.js
Outdated
return Promise.all([ | ||
t1.commit(), | ||
t2.commit() | ||
]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semi colon failing tests
You need to add a skip lock example here |
docs/transactions.md
Outdated
@@ -219,3 +219,26 @@ sequelize.transaction({ | |||
The `transaction` option goes with most other options, which are usually the first argument of a method. | |||
For methods that take values, like `.create`, `.update()`, `.updateAttributes()` etc. `transaction` should be passed to the option in the second argument. | |||
If unsure, refer to the API documentation for the method you are using to be sure of the signature. | |||
|
|||
## Locks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can improve this by adding more examples from here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few changes otherwise looks good
@sushantdhiman Pushed some changes for the above |
test/integration/transaction.test.js
Outdated
username: Support.Sequelize.STRING, | ||
awesome: Support.Sequelize.BOOLEAN | ||
}), | ||
self = this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove self = this
, it should not be required with arrow functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests for MySQL case are failing for incorrect SQL
Okay cool, will have a look. Looks like skip locked is only available in MYSQL 8. I'll remove for mysql and fix up tomorrow. |
9a34b60
to
554783b
Compare
@sushantdhiman Removed support for mysql |
This was added in sequelize#9197 but not added to the docs for `findAll`.
This was added in sequelize#9197 but not added to the docs for `findAll`.
Pull Request check-list
Please make sure to review and check all of these items:
npm run test
ornpm run test-DIALECT
pass with this change (including linting)?Description of change
#8910
Adding SKIP LOCKED to lock queries.
Where should I write tests for this?
Where would you like the docs?