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 14377dab
authored
Jul 21, 2016
by
hendrul
Committed by
Sushant
Jul 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix sequelize.transaction() breaks when used with Promise.mapSeries (#5943) (#6319)
1 parent
9344249c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
lib/promise.js
test/integration/cls.test.js
lib/promise.js
View file @
14377da
...
...
@@ -33,10 +33,12 @@ shimCLS(Promise.prototype, 'finally', [0]);
// Collections
shimCLS
(
Promise
,
'map'
,
[
1
]);
shimCLS
(
Promise
,
'mapSeries'
,
[
1
]);
shimCLS
(
Promise
,
'reduce'
,
[
1
]);
shimCLS
(
Promise
,
'filter'
,
[
1
]);
shimCLS
(
Promise
,
'each'
,
[
1
]);
shimCLS
(
Promise
.
prototype
,
'map'
,
[
0
]);
shimCLS
(
Promise
.
prototype
,
'mapSeries'
,
[
0
]);
shimCLS
(
Promise
.
prototype
,
'reduce'
,
[
0
]);
shimCLS
(
Promise
.
prototype
,
'filter'
,
[
0
]);
shimCLS
(
Promise
.
prototype
,
'each'
,
[
0
]);
...
...
test/integration/cls.test.js
View file @
14377da
...
...
@@ -256,6 +256,30 @@ if (current.dialect.supports.transactions) {
});
});
it
(
'mapSeries'
,
function
()
{
var
self
=
this
;
return
this
.
sequelize
.
transaction
(
function
()
{
var
tid
=
self
.
ns
.
get
(
'transaction'
).
id
;
return
self
.
User
.
findAll
().
mapSeries
(
function
()
{
expect
(
self
.
ns
.
get
(
'transaction'
).
id
).
to
.
be
.
ok
;
expect
(
self
.
ns
.
get
(
'transaction'
).
id
).
to
.
equal
(
tid
);
});
});
});
it
(
'static mapSeries'
,
function
()
{
var
self
=
this
;
return
this
.
sequelize
.
transaction
(
function
()
{
var
tid
=
self
.
ns
.
get
(
'transaction'
).
id
;
// In order to execute promises serially with mapSeries we must wrap them as functions
return
self
.
sequelize
.
Promise
.
mapSeries
([
()
=>
self
.
User
.
findAll
().
then
(()
=>
expect
(
self
.
ns
.
get
(
'transaction'
).
id
).
to
.
be
.
ok
),
()
=>
self
.
User
.
findAll
().
then
(()
=>
expect
(
self
.
ns
.
get
(
'transaction'
).
id
).
to
.
equal
(
tid
))
],
runPromise
=>
runPromise
()
);
});
});
it
(
'reduce'
,
function
()
{
var
self
=
this
;
return
this
.
sequelize
.
transaction
(
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