{"action":"created","issue":{"url":"https://api.github.com/repos/top-think/think-swoole/issues/35","repository_url":"https://api.github.com/repos/top-think/think-swoole","labels_url":"https://api.github.com/repos/top-think/think-swoole/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/top-think/think-swoole/issues/35/comments","events_url":"https://api.github.com/repos/top-think/think-swoole/issues/35/events","html_url":"https://github.com/top-think/think-swoole/issues/35","id":360132929,"node_id":"MDU6SXNzdWUzNjAxMzI5Mjk=","number":35,"title":"协程中数据库问题","user":{"login":"wydhit","id":17060640,"node_id":"MDQ6VXNlcjE3MDYwNjQw","avatar_url":"https://avatars2.githubusercontent.com/u/17060640?v=4","gravatar_id":"","url":"https://api.github.com/users/wydhit","html_url":"https://github.com/wydhit","followers_url":"https://api.github.com/users/wydhit/followers","following_url":"https://api.github.com/users/wydhit/following{/other_user}","gists_url":"https://api.github.com/users/wydhit/gists{/gist_id}","starred_url":"https://api.github.com/users/wydhit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wydhit/subscriptions","organizations_url":"https://api.github.com/users/wydhit/orgs","repos_url":"https://api.github.com/users/wydhit/repos","events_url":"https://api.github.com/users/wydhit/events{/privacy}","received_events_url":"https://api.github.com/users/wydhit/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-09-14T02:23:10Z","updated_at":"2018-09-21T05:57:23Z","closed_at":null,"author_association":"NONE","body":"协程模式下，同一个worker下全局变量共享，那么数据库连接也应该是共享的，\\think\\Db::$connection，但是有多个协程在执行，多个协程在复用这个连接，在实际的业务逻辑中又用到了事务，不会存在冲突吗？\r\n\r\n比如这种情况：协程A 开启事务   这个事务比较耗时  这是会执行协程B，协程B进行了一个插入操作，返回协程A  ，这时候协程A事务回滚，这样协程B的插入操作就失效了。（协程A B 执行不同的请求）\r\n或者类似于这样的其他冲突情况。"},"comment":{"url":"https://api.github.com/repos/top-think/think-swoole/issues/comments/423422186","html_url":"https://github.com/top-think/think-swoole/issues/35#issuecomment-423422186","issue_url":"https://api.github.com/repos/top-think/think-swoole/issues/35","id":423422186,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzQyMjE4Ng==","user":{"login":"xavieryang007","id":6174650,"node_id":"MDQ6VXNlcjYxNzQ2NTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6174650?v=4","gravatar_id":"","url":"https://api.github.com/users/xavieryang007","html_url":"https://github.com/xavieryang007","followers_url":"https://api.github.com/users/xavieryang007/followers","following_url":"https://api.github.com/users/xavieryang007/following{/other_user}","gists_url":"https://api.github.com/users/xavieryang007/gists{/gist_id}","starred_url":"https://api.github.com/users/xavieryang007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xavieryang007/subscriptions","organizations_url":"https://api.github.com/users/xavieryang007/orgs","repos_url":"https://api.github.com/users/xavieryang007/repos","events_url":"https://api.github.com/users/xavieryang007/events{/privacy}","received_events_url":"https://api.github.com/users/xavieryang007/received_events","type":"User","site_admin":false},"created_at":"2018-09-21T05:57:23Z","updated_at":"2018-09-21T05:57:23Z","author_association":"CONTRIBUTOR","body":"分开实例，也就是分开链接。这样A=PDO_MYSQL  ,B=pdo_mysql，  这样A的事务不会干扰B"}}
{"actor":{"display_login":"xavieryang007"}}