{"action":"created","issue":{"url":"https://api.github.com/repos/ruby-amqp/bunny/issues/340","labels_url":"https://api.github.com/repos/ruby-amqp/bunny/issues/340/labels{/name}","comments_url":"https://api.github.com/repos/ruby-amqp/bunny/issues/340/comments","events_url":"https://api.github.com/repos/ruby-amqp/bunny/issues/340/events","html_url":"https://github.com/ruby-amqp/bunny/pull/340","id":103098986,"number":340,"title":"Get state of work pool more accurately ","user":{"login":"dhananjaysathe","id":866950,"avatar_url":"https://avatars.githubusercontent.com/u/866950?v=3","gravatar_id":"","url":"https://api.github.com/users/dhananjaysathe","html_url":"https://github.com/dhananjaysathe","followers_url":"https://api.github.com/users/dhananjaysathe/followers","following_url":"https://api.github.com/users/dhananjaysathe/following{/other_user}","gists_url":"https://api.github.com/users/dhananjaysathe/gists{/gist_id}","starred_url":"https://api.github.com/users/dhananjaysathe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhananjaysathe/subscriptions","organizations_url":"https://api.github.com/users/dhananjaysathe/orgs","repos_url":"https://api.github.com/users/dhananjaysathe/repos","events_url":"https://api.github.com/users/dhananjaysathe/events{/privacy}","received_events_url":"https://api.github.com/users/dhananjaysathe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-25T19:32:56Z","updated_at":"2015-08-25T19:36:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ruby-amqp/bunny/pulls/340","html_url":"https://github.com/ruby-amqp/bunny/pull/340","diff_url":"https://github.com/ruby-amqp/bunny/pull/340.diff","patch_url":"https://github.com/ruby-amqp/bunny/pull/340.patch"},"body":"Add a way to fetch actual state of queue. The running method does not provide you with the state of the actual processing happens and simply indicates if the pool has not been paused or killed\r\n\r\nThis commit introduces 2 methods that exposes relevant part of the internal queue datastructue without making it public using attr_<methods>. the are namely  a) Backlog b) Busy? both these can be used for cleaner shutdown mechanisms (the channle close causes unclen shutdowns as threads are really still active), and making decisions for dynamic scaling workers using queue \"backpressure\""},"comment":{"url":"https://api.github.com/repos/ruby-amqp/bunny/issues/comments/134711204","html_url":"https://github.com/ruby-amqp/bunny/pull/340#issuecomment-134711204","issue_url":"https://api.github.com/repos/ruby-amqp/bunny/issues/340","id":134711204,"user":{"login":"dhananjaysathe","id":866950,"avatar_url":"https://avatars.githubusercontent.com/u/866950?v=3","gravatar_id":"","url":"https://api.github.com/users/dhananjaysathe","html_url":"https://github.com/dhananjaysathe","followers_url":"https://api.github.com/users/dhananjaysathe/followers","following_url":"https://api.github.com/users/dhananjaysathe/following{/other_user}","gists_url":"https://api.github.com/users/dhananjaysathe/gists{/gist_id}","starred_url":"https://api.github.com/users/dhananjaysathe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhananjaysathe/subscriptions","organizations_url":"https://api.github.com/users/dhananjaysathe/orgs","repos_url":"https://api.github.com/users/dhananjaysathe/repos","events_url":"https://api.github.com/users/dhananjaysathe/events{/privacy}","received_events_url":"https://api.github.com/users/dhananjaysathe/received_events","type":"User","site_admin":false},"created_at":"2015-08-25T19:36:23Z","updated_at":"2015-08-25T19:36:23Z","body":"@michaelklishin there is a fundamental problem in the way channel close method works the https://github.com/ruby-amqp/bunny/blob/master/lib/bunny/channel.rb#L232 works \r\n\r\nThe channel connection is closed before the pool actually shuts down. Else the executing contexts in the thread pool end up trying to access the closed channel causing bad errors (its hard to predict at which state this may occur , further complicating it )  \r\n\r\nI've got a commit ready if you are up for it ?"}}