{"action":"created","issue":{"url":"https://api.github.com/repos/igrigorik/em-synchrony/issues/179","labels_url":"https://api.github.com/repos/igrigorik/em-synchrony/issues/179/labels{/name}","comments_url":"https://api.github.com/repos/igrigorik/em-synchrony/issues/179/comments","events_url":"https://api.github.com/repos/igrigorik/em-synchrony/issues/179/events","html_url":"https://github.com/igrigorik/em-synchrony/pull/179","id":27224624,"number":179,"title":"Really fiber-aware ActiveRecord connection pool and em_mysql2 adapter","user":{"login":"mrms-dos","id":2018901,"avatar_url":"https://avatars.githubusercontent.com/u/2018901?v=3","gravatar_id":"","url":"https://api.github.com/users/mrms-dos","html_url":"https://github.com/mrms-dos","followers_url":"https://api.github.com/users/mrms-dos/followers","following_url":"https://api.github.com/users/mrms-dos/following{/other_user}","gists_url":"https://api.github.com/users/mrms-dos/gists{/gist_id}","starred_url":"https://api.github.com/users/mrms-dos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrms-dos/subscriptions","organizations_url":"https://api.github.com/users/mrms-dos/orgs","repos_url":"https://api.github.com/users/mrms-dos/repos","events_url":"https://api.github.com/users/mrms-dos/events{/privacy}","received_events_url":"https://api.github.com/users/mrms-dos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-02-09T15:43:39Z","updated_at":"2015-01-27T15:29:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/igrigorik/em-synchrony/pulls/179","html_url":"https://github.com/igrigorik/em-synchrony/pull/179","diff_url":"https://github.com/igrigorik/em-synchrony/pull/179.diff","patch_url":"https://github.com/igrigorik/em-synchrony/pull/179.patch"},"body":"This implementation supports concurrent running transactions. We tested it with active_record 3.2, but did not test with 4.0. We are using it in production and it is working well.\r\n\r\nActiveRecord have already had good connection pooling, that uses Thread.current[] for thread-aware (and fiber-aware) storage. We replaced original MonitorMixin, by fiber-aware one, and thats all."},"comment":{"url":"https://api.github.com/repos/igrigorik/em-synchrony/issues/comments/71666496","html_url":"https://github.com/igrigorik/em-synchrony/pull/179#issuecomment-71666496","issue_url":"https://api.github.com/repos/igrigorik/em-synchrony/issues/179","id":71666496,"user":{"login":"marshall-lee","id":3194530,"avatar_url":"https://avatars.githubusercontent.com/u/3194530?v=3","gravatar_id":"","url":"https://api.github.com/users/marshall-lee","html_url":"https://github.com/marshall-lee","followers_url":"https://api.github.com/users/marshall-lee/followers","following_url":"https://api.github.com/users/marshall-lee/following{/other_user}","gists_url":"https://api.github.com/users/marshall-lee/gists{/gist_id}","starred_url":"https://api.github.com/users/marshall-lee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marshall-lee/subscriptions","organizations_url":"https://api.github.com/users/marshall-lee/orgs","repos_url":"https://api.github.com/users/marshall-lee/repos","events_url":"https://api.github.com/users/marshall-lee/events{/privacy}","received_events_url":"https://api.github.com/users/marshall-lee/received_events","type":"User","site_admin":false},"created_at":"2015-01-27T15:29:27Z","updated_at":"2015-01-27T15:29:27Z","body":"Now i'm trying to use `em-pg-client` with ActiveRecord 4.2 and `ConnectionPool` with fiber aware `MonitorMixin` from this PR. Things are almost the same at first sight and it should work.\r\n\r\nThe little difference coming from 4.2 is:\r\n\r\n```ruby\r\nmodule ActiveRecord\r\n  module ConnectionAdapters\r\n    class AbstractAdapter\r\n      include EventMachine::Synchrony::MonitorMixin\r\n\r\n      if [ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR] == [4, 2]\r\n        def lease\r\n          synchronize do\r\n            unless in_use?\r\n              @owner = Fiber.current\r\n            end\r\n          end\r\n        end\r\n      end\r\n    end\r\n  end\r\nend\r\n```"}}