不要怂,就是干,撸起袖子干!

Commit b903384e by Maxime Suret Committed by Sushant

fix(transactions): return patched promise from sequelize.query (#9473)

1 parent 51797c7b
......@@ -451,7 +451,7 @@ class Sequelize {
let bindParameters;
return retry(retryParameters => Promise.try(() => {
return Promise.resolve(retry(retryParameters => Promise.try(() => {
const isFirstTry = retryParameters.current === 1;
if (options.instance && !options.model) {
......@@ -565,7 +565,7 @@ class Sequelize {
return this.connectionManager.releaseConnection(connection);
}
});
}), retryOptions);
}), retryOptions));
}
/**
......
......@@ -164,5 +164,12 @@ if (current.dialect.supports.transactions) {
it('CLS namespace is stored in Sequelize._cls', function() {
expect(Sequelize._cls).to.equal(this.ns);
});
it('promises returned by sequelize.query are correctly patched', function() {
return this.sequelize.transaction(t =>
this.sequelize.query('select 1', {type: Sequelize.QueryTypes.SELECT})
.then(() => expect(this.ns.get('transaction')).to.equal(t))
);
});
});
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!