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

Commit 2cd9db34 by Mick Hansen

fix: transaction should unset itself from cls on cleanup, closes #3375

1 parent b010ac21
......@@ -152,7 +152,15 @@ Transaction.prototype.setIsolationLevel = function() {
};
Transaction.prototype.cleanup = function() {
var cls = this.sequelize.constructor.cls;
this.connection.uuid = undefined;
if (cls) {
if (cls.get('transaction') === this) {
cls.set('transaction', null);
}
}
return this.sequelize.connectionManager.releaseConnection(this.connection);
};
......@@ -113,6 +113,18 @@ if (current.dialect.supports.transactions) {
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 () {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!