{"action":"created","issue":{"url":"https://api.github.com/repos/petkaantonov/bluebird/issues/964","labels_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/964/labels{/name}","comments_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/964/comments","events_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/964/events","html_url":"https://github.com/petkaantonov/bluebird/issues/964","id":127165482,"number":964,"title":"mysql beginTransactionAsync finally no work","user":{"login":"huangyunbo","id":11435398,"avatar_url":"https://avatars.githubusercontent.com/u/11435398?v=3","gravatar_id":"","url":"https://api.github.com/users/huangyunbo","html_url":"https://github.com/huangyunbo","followers_url":"https://api.github.com/users/huangyunbo/followers","following_url":"https://api.github.com/users/huangyunbo/following{/other_user}","gists_url":"https://api.github.com/users/huangyunbo/gists{/gist_id}","starred_url":"https://api.github.com/users/huangyunbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huangyunbo/subscriptions","organizations_url":"https://api.github.com/users/huangyunbo/orgs","repos_url":"https://api.github.com/users/huangyunbo/repos","events_url":"https://api.github.com/users/huangyunbo/events{/privacy}","received_events_url":"https://api.github.com/users/huangyunbo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-18T06:56:32Z","updated_at":"2016-01-18T07:54:41Z","closed_at":null,"body":"db.js\r\n\r\n```javascript\r\nvar Promise = require(\"bluebird\");\r\nvar mysql = require('mysql');\r\nPromise.promisifyAll(require(\"mysql/lib/Connection\").prototype);\r\nPromise.promisifyAll(require(\"mysql/lib/Pool\").prototype);\r\n\r\nvar Db = {};\r\n\r\nvar pool = mysql.createPool({\r\n    host:'10.8.2.228',\r\n    user:'root',\r\n    password:'xxx',\r\n    database:'xxx',\r\n    multipleStatements:true\r\n});\r\n\r\nDb.getPool = function(){\r\n    return new Promise(function(resolve, reject){\r\n        pool.getConnectionAsync().then(function(connection){\r\n            resolve(connection);\r\n        });\r\n    });\r\n};\r\n\r\nmodule.exports = Db;\r\n```\r\n\r\n\r\ncommunity.js\r\n```javascript\r\nvar Db = require('../models/db.js');\r\nvar Promise = require(\"bluebird\");\r\n\r\nvar Community = {};\r\n\r\nCommunity.deleteArticle = function(tid, callback){\r\n   Db.getPool().then(function(connection){\r\n        connection.beginTransactionAsync(function(){\r\n            return new Promise(function(resolve, reject){\r\n                //connection.rollbackAsync();\r\n                //connection.commitAsync();\r\n                console.log('beginTransaction!');//I saw beginTransaction!\r\n                resolve('ok');\r\n            })\r\n        }).finally(function(){//or then not work\r\n            console.log('last connection');//not work\r\n            connection.release();\r\n        });\r\n    });\r\n};\r\n\r\nmodule.exports = Community;\r\n```\r\n\r\n\r\nnode version v4.2.1\r\nnpm mysql version v2.10.0\r\nnpm bluebird version v3.1.1\r\n\r\nI need help. thank u"},"comment":{"url":"https://api.github.com/repos/petkaantonov/bluebird/issues/comments/172454511","html_url":"https://github.com/petkaantonov/bluebird/issues/964#issuecomment-172454511","issue_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/964","id":172454511,"user":{"login":"phpnode","id":363611,"avatar_url":"https://avatars.githubusercontent.com/u/363611?v=3","gravatar_id":"","url":"https://api.github.com/users/phpnode","html_url":"https://github.com/phpnode","followers_url":"https://api.github.com/users/phpnode/followers","following_url":"https://api.github.com/users/phpnode/following{/other_user}","gists_url":"https://api.github.com/users/phpnode/gists{/gist_id}","starred_url":"https://api.github.com/users/phpnode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phpnode/subscriptions","organizations_url":"https://api.github.com/users/phpnode/orgs","repos_url":"https://api.github.com/users/phpnode/repos","events_url":"https://api.github.com/users/phpnode/events{/privacy}","received_events_url":"https://api.github.com/users/phpnode/received_events","type":"User","site_admin":false},"created_at":"2016-01-18T07:54:41Z","updated_at":"2016-01-18T07:54:41Z","body":"you're misusing promises, you don't need to return a `new Promise()` from within a then handler, you can just return `\"ok\"`"}}