{"action":"created","comment":{"url":"https://api.github.com/repos/hhru/frontik/pulls/comments/83300552","pull_request_review_id":4154352,"id":83300552,"diff_hunk":"@@ -74,19 +85,43 @@ def _fail_on_error_wrapper(name, data, response):\n             status_code = response.code if 300 <= response.code < 500 else 502\n             raise HTTPError(status_code, 'HTTP request failed with code {}'.format(response.code))\n \n+        def _resolve_future_wrapper(wrapper, timeout_to_cancel, future):\n+            if not wrapper.done():\n+                if timeout_to_cancel:\n+                    self.remove_timeout(timeout_to_cancel)\n+\n+                try:\n+                    result = future.result(0)\n+                    result_holder = MicroHandler._FutureResultHolder(data=result, exception=None)\n+                except Exception as e:\n+                    result_holder = MicroHandler._FutureResultHolder(data=None, exception=e)\n+\n+                wrapper.set_result(result_holder)\n+\n         if isinstance(return_value, dict):\n             futures = {}\n             for name, req in iteritems(return_value):\n-                req_type = getattr(req, 'method', None)\n-                if req_type not in self._METHODS_MAPPING:\n-                    raise Exception('Invalid request object: {!r}'.format(req))\n+                if isinstance(req, MicroHandler._Future):\n+                    future_wrapper = Future()\n+                    timeout = self.add_timeout(IOLoop.instance().time() + req.timeout,","path":"frontik/micro_handler.py","position":53,"original_position":51,"commit_id":"68268cb040a8fbe2f7300eea3b5f1032183bd721","original_commit_id":"9a27fed6dfa04afffbfa916b7842cdf7b6ea2387","user":{"login":"bokshitsky","id":6561391,"avatar_url":"https://avatars.githubusercontent.com/u/6561391?v=3","gravatar_id":"","url":"https://api.github.com/users/bokshitsky","html_url":"https://github.com/bokshitsky","followers_url":"https://api.github.com/users/bokshitsky/followers","following_url":"https://api.github.com/users/bokshitsky/following{/other_user}","gists_url":"https://api.github.com/users/bokshitsky/gists{/gist_id}","starred_url":"https://api.github.com/users/bokshitsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bokshitsky/subscriptions","organizations_url":"https://api.github.com/users/bokshitsky/orgs","repos_url":"https://api.github.com/users/bokshitsky/repos","events_url":"https://api.github.com/users/bokshitsky/events{/privacy}","received_events_url":"https://api.github.com/users/bokshitsky/received_events","type":"User","site_admin":false},"body":"Таким образом: да - клиенту неплохо бы (таки надо) иметь свои fail-on-error колбеки и таймауты, но так мы в дополнение к этому имеем хотя бы теоретическую возможность ограничить время выполнения фьючи.\r\n\r\nЯ считаю, что это таки неплохой контракт - есть так уж страшат 2 секунды дефолтные, давай поставим 10. Зато в тяжелый момент, момент нужды, когда тебе нужен будет таймаут для непонятной фьючи из опенсорсной библиотеке написанной на сях и делающей хер знает что - ты найдешь в себе мужество и возможность впилить этот таймаут, а не будешь проклинать судьбу за упущенную возможность.","created_at":"2016-10-13T20:09:08Z","updated_at":"2016-10-13T20:09:08Z","html_url":"https://github.com/hhru/frontik/pull/268#discussion_r83300552","pull_request_url":"https://api.github.com/repos/hhru/frontik/pulls/268","_links":{"self":{"href":"https://api.github.com/repos/hhru/frontik/pulls/comments/83300552"},"html":{"href":"https://github.com/hhru/frontik/pull/268#discussion_r83300552"},"pull_request":{"href":"https://api.github.com/repos/hhru/frontik/pulls/268"}}},"pull_request":{"url":"https://api.github.com/repos/hhru/frontik/pulls/268","id":88808618,"html_url":"https://github.com/hhru/frontik/pull/268","diff_url":"https://github.com/hhru/frontik/pull/268.diff","patch_url":"https://github.com/hhru/frontik/pull/268.patch","issue_url":"https://api.github.com/repos/hhru/frontik/issues/268","number":268,"state":"open","locked":false,"title":"Hh 63288","user":{"login":"bokshitsky","id":6561391,"avatar_url":"https://avatars.githubusercontent.com/u/6561391?v=3","gravatar_id":"","url":"https://api.github.com/users/bokshitsky","html_url":"https://github.com/bokshitsky","followers_url":"https://api.github.com/users/bokshitsky/followers","following_url":"https://api.github.com/users/bokshitsky/following{/other_user}","gists_url":"https://api.github.com/users/bokshitsky/gists{/gist_id}","starred_url":"https://api.github.com/users/bokshitsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bokshitsky/subscriptions","organizations_url":"https://api.github.com/users/bokshitsky/orgs","repos_url":"https://api.github.com/users/bokshitsky/repos","events_url":"https://api.github.com/users/bokshitsky/events{/privacy}","received_events_url":"https://api.github.com/users/bokshitsky/received_events","type":"User","site_admin":false},"body":"https://jira.hh.ru/browse/HH-63288","created_at":"2016-10-11T10:34:07Z","updated_at":"2016-10-13T20:09:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8abe8659713a4a36e70a0a7f35bb602c983bfa97","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hhru/frontik/pulls/268/commits","review_comments_url":"https://api.github.com/repos/hhru/frontik/pulls/268/comments","review_comment_url":"https://api.github.com/repos/hhru/frontik/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hhru/frontik/issues/268/comments","statuses_url":"https://api.github.com/repos/hhru/frontik/statuses/68268cb040a8fbe2f7300eea3b5f1032183bd721","head":{"label":"hhru:HH-63288","ref":"HH-63288","sha":"68268cb040a8fbe2f7300eea3b5f1032183bd721","user":{"login":"hhru","id":152753,"avatar_url":"https://avatars.githubusercontent.com/u/152753?v=3","gravatar_id":"","url":"https://api.github.com/users/hhru","html_url":"https://github.com/hhru","followers_url":"https://api.github.com/users/hhru/followers","following_url":"https://api.github.com/users/hhru/following{/other_user}","gists_url":"https://api.github.com/users/hhru/gists{/gist_id}","starred_url":"https://api.github.com/users/hhru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hhru/subscriptions","organizations_url":"https://api.github.com/users/hhru/orgs","repos_url":"https://api.github.com/users/hhru/repos","events_url":"https://api.github.com/users/hhru/events{/privacy}","received_events_url":"https://api.github.com/users/hhru/received_events","type":"Organization","site_admin":false},"repo":{"id":825839,"name":"frontik","full_name":"hhru/frontik","owner":{"login":"hhru","id":152753,"avatar_url":"https://avatars.githubusercontent.com/u/152753?v=3","gravatar_id":"","url":"https://api.github.com/users/hhru","html_url":"https://github.com/hhru","followers_url":"https://api.github.com/users/hhru/followers","following_url":"https://api.github.com/users/hhru/following{/other_user}","gists_url":"https://api.github.com/users/hhru/gists{/gist_id}","starred_url":"https://api.github.com/users/hhru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hhru/subscriptions","organizations_url":"https://api.github.com/users/hhru/orgs","repos_url":"https://api.github.com/users/hhru/repos","events_url":"https://api.github.com/users/hhru/events{/privacy}","received_events_url":"https://api.github.com/users/hhru/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hhru/frontik","description":"Maintainers: Сумин","fork":false,"url":"https://api.github.com/repos/hhru/frontik","forks_url":"https://api.github.com/repos/hhru/frontik/forks","keys_url":"https://api.github.com/repos/hhru/frontik/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hhru/frontik/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hhru/frontik/teams","hooks_url":"https://api.github.com/repos/hhru/frontik/hooks","issue_events_url":"https://api.github.com/repos/hhru/frontik/issues/events{/number}","events_url":"https://api.github.com/repos/hhru/frontik/events","assignees_url":"https://api.github.com/repos/hhru/frontik/assignees{/user}","branches_url":"https://api.github.com/repos/hhru/frontik/branches{/branch}","tags_url":"https://api.github.com/repos/hhru/frontik/tags","blobs_url":"https://api.github.com/repos/hhru/frontik/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hhru/frontik/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hhru/frontik/git/refs{/sha}","trees_url":"https://api.github.com/repos/hhru/frontik/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hhru/frontik/statuses/{sha}","languages_url":"https://api.github.com/repos/hhru/frontik/languages","stargazers_url":"https://api.github.com/repos/hhru/frontik/stargazers","contributors_url":"https://api.github.com/repos/hhru/frontik/contributors","subscribers_url":"https://api.github.com/repos/hhru/frontik/subscribers","subscription_url":"https://api.github.com/repos/hhru/frontik/subscription","commits_url":"https://api.github.com/repos/hhru/frontik/commits{/sha}","git_commits_url":"https://api.github.com/repos/hhru/frontik/git/commits{/sha}","comments_url":"https://api.github.com/repos/hhru/frontik/comments{/number}","issue_comment_url":"https://api.github.com/repos/hhru/frontik/issues/comments{/number}","contents_url":"https://api.github.com/repos/hhru/frontik/contents/{+path}","compare_url":"https://api.github.com/repos/hhru/frontik/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hhru/frontik/merges","archive_url":"https://api.github.com/repos/hhru/frontik/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hhru/frontik/downloads","issues_url":"https://api.github.com/repos/hhru/frontik/issues{/number}","pulls_url":"https://api.github.com/repos/hhru/frontik/pulls{/number}","milestones_url":"https://api.github.com/repos/hhru/frontik/milestones{/number}","notifications_url":"https://api.github.com/repos/hhru/frontik/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hhru/frontik/labels{/name}","releases_url":"https://api.github.com/repos/hhru/frontik/releases{/id}","deployments_url":"https://api.github.com/repos/hhru/frontik/deployments","created_at":"2010-08-09T05:13:13Z","updated_at":"2016-09-06T23:27:43Z","pushed_at":"2016-10-12T16:56:23Z","git_url":"git://github.com/hhru/frontik.git","ssh_url":"git@github.com:hhru/frontik.git","clone_url":"https://github.com/hhru/frontik.git","svn_url":"https://github.com/hhru/frontik","homepage":"","size":2720,"stargazers_count":35,"watchers_count":35,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":4,"forks":7,"open_issues":4,"watchers":35,"default_branch":"master"}},"base":{"label":"hhru:master","ref":"master","sha":"5483b283a824b7354090c15750f61693a2dc1451","user":{"login":"hhru","id":152753,"avatar_url":"https://avatars.githubusercontent.com/u/152753?v=3","gravatar_id":"","url":"https://api.github.com/users/hhru","html_url":"https://github.com/hhru","followers_url":"https://api.github.com/users/hhru/followers","following_url":"https://api.github.com/users/hhru/following{/other_user}","gists_url":"https://api.github.com/users/hhru/gists{/gist_id}","starred_url":"https://api.github.com/users/hhru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hhru/subscriptions","organizations_url":"https://api.github.com/users/hhru/orgs","repos_url":"https://api.github.com/users/hhru/repos","events_url":"https://api.github.com/users/hhru/events{/privacy}","received_events_url":"https://api.github.com/users/hhru/received_events","type":"Organization","site_admin":false},"repo":{"id":825839,"name":"frontik","full_name":"hhru/frontik","owner":{"login":"hhru","id":152753,"avatar_url":"https://avatars.githubusercontent.com/u/152753?v=3","gravatar_id":"","url":"https://api.github.com/users/hhru","html_url":"https://github.com/hhru","followers_url":"https://api.github.com/users/hhru/followers","following_url":"https://api.github.com/users/hhru/following{/other_user}","gists_url":"https://api.github.com/users/hhru/gists{/gist_id}","starred_url":"https://api.github.com/users/hhru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hhru/subscriptions","organizations_url":"https://api.github.com/users/hhru/orgs","repos_url":"https://api.github.com/users/hhru/repos","events_url":"https://api.github.com/users/hhru/events{/privacy}","received_events_url":"https://api.github.com/users/hhru/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hhru/frontik","description":"Maintainers: Сумин","fork":false,"url":"https://api.github.com/repos/hhru/frontik","forks_url":"https://api.github.com/repos/hhru/frontik/forks","keys_url":"https://api.github.com/repos/hhru/frontik/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hhru/frontik/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hhru/frontik/teams","hooks_url":"https://api.github.com/repos/hhru/frontik/hooks","issue_events_url":"https://api.github.com/repos/hhru/frontik/issues/events{/number}","events_url":"https://api.github.com/repos/hhru/frontik/events","assignees_url":"https://api.github.com/repos/hhru/frontik/assignees{/user}","branches_url":"https://api.github.com/repos/hhru/frontik/branches{/branch}","tags_url":"https://api.github.com/repos/hhru/frontik/tags","blobs_url":"https://api.github.com/repos/hhru/frontik/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hhru/frontik/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hhru/frontik/git/refs{/sha}","trees_url":"https://api.github.com/repos/hhru/frontik/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hhru/frontik/statuses/{sha}","languages_url":"https://api.github.com/repos/hhru/frontik/languages","stargazers_url":"https://api.github.com/repos/hhru/frontik/stargazers","contributors_url":"https://api.github.com/repos/hhru/frontik/contributors","subscribers_url":"https://api.github.com/repos/hhru/frontik/subscribers","subscription_url":"https://api.github.com/repos/hhru/frontik/subscription","commits_url":"https://api.github.com/repos/hhru/frontik/commits{/sha}","git_commits_url":"https://api.github.com/repos/hhru/frontik/git/commits{/sha}","comments_url":"https://api.github.com/repos/hhru/frontik/comments{/number}","issue_comment_url":"https://api.github.com/repos/hhru/frontik/issues/comments{/number}","contents_url":"https://api.github.com/repos/hhru/frontik/contents/{+path}","compare_url":"https://api.github.com/repos/hhru/frontik/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hhru/frontik/merges","archive_url":"https://api.github.com/repos/hhru/frontik/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hhru/frontik/downloads","issues_url":"https://api.github.com/repos/hhru/frontik/issues{/number}","pulls_url":"https://api.github.com/repos/hhru/frontik/pulls{/number}","milestones_url":"https://api.github.com/repos/hhru/frontik/milestones{/number}","notifications_url":"https://api.github.com/repos/hhru/frontik/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hhru/frontik/labels{/name}","releases_url":"https://api.github.com/repos/hhru/frontik/releases{/id}","deployments_url":"https://api.github.com/repos/hhru/frontik/deployments","created_at":"2010-08-09T05:13:13Z","updated_at":"2016-09-06T23:27:43Z","pushed_at":"2016-10-12T16:56:23Z","git_url":"git://github.com/hhru/frontik.git","ssh_url":"git@github.com:hhru/frontik.git","clone_url":"https://github.com/hhru/frontik.git","svn_url":"https://github.com/hhru/frontik","homepage":"","size":2720,"stargazers_count":35,"watchers_count":35,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":4,"forks":7,"open_issues":4,"watchers":35,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hhru/frontik/pulls/268"},"html":{"href":"https://github.com/hhru/frontik/pull/268"},"issue":{"href":"https://api.github.com/repos/hhru/frontik/issues/268"},"comments":{"href":"https://api.github.com/repos/hhru/frontik/issues/268/comments"},"review_comments":{"href":"https://api.github.com/repos/hhru/frontik/pulls/268/comments"},"review_comment":{"href":"https://api.github.com/repos/hhru/frontik/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hhru/frontik/pulls/268/commits"},"statuses":{"href":"https://api.github.com/repos/hhru/frontik/statuses/68268cb040a8fbe2f7300eea3b5f1032183bd721"}}}}
{"actor":{"display_login":"bokshitsky"}}