Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 2cd9db34
authored
Apr 23, 2015
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: transaction should unset itself from cls on cleanup, closes #3375
1 parent
b010ac21
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
lib/transaction.js
test/integration/cls.test.js
lib/transaction.js
View file @
2cd9db3
...
@@ -152,7 +152,15 @@ Transaction.prototype.setIsolationLevel = function() {
...
@@ -152,7 +152,15 @@ Transaction.prototype.setIsolationLevel = function() {
};
};
Transaction
.
prototype
.
cleanup
=
function
()
{
Transaction
.
prototype
.
cleanup
=
function
()
{
var
cls
=
this
.
sequelize
.
constructor
.
cls
;
this
.
connection
.
uuid
=
undefined
;
this
.
connection
.
uuid
=
undefined
;
if
(
cls
)
{
if
(
cls
.
get
(
'transaction'
)
===
this
)
{
cls
.
set
(
'transaction'
,
null
);
}
}
return
this
.
sequelize
.
connectionManager
.
releaseConnection
(
this
.
connection
);
return
this
.
sequelize
.
connectionManager
.
releaseConnection
(
this
.
connection
);
};
};
test/integration/cls.test.js
View file @
2cd9db3
...
@@ -113,6 +113,18 @@ if (current.dialect.supports.transactions) {
...
@@ -113,6 +113,18 @@ if (current.dialect.supports.transactions) {
expect
(
this
.
ns
.
get
(
'transaction'
)).
not
.
to
.
be
.
ok
;
expect
(
this
.
ns
.
get
(
'transaction'
)).
not
.
to
.
be
.
ok
;
});
});
});
});
it
(
'does not leak outside findOrCreate'
,
function
()
{
var
self
=
this
;
return
this
.
User
.
findOrCreate
({
where
:
{
name
:
'Kafka'
}
}).
then
(
function
()
{
return
self
.
User
.
findAll
();
});
});
});
});
describe
(
'sequelize.query integration'
,
function
()
{
describe
(
'sequelize.query integration'
,
function
()
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment