{"action":"created","comment":{"url":"https://api.github.com/repos/StackStorm/st2/pulls/comments/141000296","pull_request_review_id":65148917,"id":141000296,"diff_hunk":"@@ -175,6 +191,50 @@ def test_garbage_collection(self):\n         stderr_dbs = ActionExecutionOutput.query(output_type='stderr')\n         self.assertEqual(len(stderr_dbs), (new_executions_count))\n \n+    def test_inquiry_garbage_collection(self):\n+        now = date_utils.get_datetime_utc_now()\n+\n+        # Insert some mock Inquiries with start_timestamp > TTL\n+        old_inquiry_count = 15\n+        timestamp = (now - datetime.timedelta(minutes=3))\n+        for index in range(0, old_inquiry_count):\n+            self._create_inquiry(ttl=2, timestamp=timestamp)\n+\n+        # Insert some mock Inquiries with start_timestamp < TTL\n+        new_inquiry_count = 5\n+        timestamp = (now - datetime.timedelta(minutes=3))\n+        for index in range(0, new_inquiry_count):\n+            self._create_inquiry(ttl=15, timestamp=timestamp)\n+\n+        filters = {\n+            'status': action_constants.LIVEACTION_STATUS_PENDING\n+        }\n+        inquiries = list(ActionExecution.query(**filters))\n+        self.assertEqual(len(inquiries),\n+                         (old_inquiry_count + new_inquiry_count))\n+\n+        # Start garbage collector\n+        process = self._start_garbage_collector()\n+\n+        # Give it some time to perform garbage collection and kill it\n+        eventlet.sleep(10)\n+        process.send_signal(signal.SIGKILL)\n+        self.remove_process(process=process)\n+\n+        # Expired Inquiries should have been garbage collected\n+        inquiries = list(ActionExecution.query(**filters))\n+        self.assertEqual(len(inquiries), new_inquiry_count)","path":"st2reactor/tests/integration/test_garbage_collector.py","position":79,"original_position":79,"commit_id":"59cdaffe3d1370c6d9f294807fd0e18804eb6280","original_commit_id":"59cdaffe3d1370c6d9f294807fd0e18804eb6280","user":{"login":"Kami","id":125088,"avatar_url":"https://avatars3.githubusercontent.com/u/125088?v=4","gravatar_id":"","url":"https://api.github.com/users/Kami","html_url":"https://github.com/Kami","followers_url":"https://api.github.com/users/Kami/followers","following_url":"https://api.github.com/users/Kami/following{/other_user}","gists_url":"https://api.github.com/users/Kami/gists{/gist_id}","starred_url":"https://api.github.com/users/Kami/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kami/subscriptions","organizations_url":"https://api.github.com/users/Kami/orgs","repos_url":"https://api.github.com/users/Kami/repos","events_url":"https://api.github.com/users/Kami/events{/privacy}","received_events_url":"https://api.github.com/users/Kami/received_events","type":"User","site_admin":false},"body":"Probably also good to assert on status - that it actually marks it as failed / timeout or whatever the status we want to use.","created_at":"2017-09-26T09:15:16Z","updated_at":"2017-09-26T09:15:16Z","html_url":"https://github.com/StackStorm/st2/pull/3762#discussion_r141000296","pull_request_url":"https://api.github.com/repos/StackStorm/st2/pulls/3762","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/StackStorm/st2/pulls/comments/141000296"},"html":{"href":"https://github.com/StackStorm/st2/pull/3762#discussion_r141000296"},"pull_request":{"href":"https://api.github.com/repos/StackStorm/st2/pulls/3762"}}},"pull_request":{"url":"https://api.github.com/repos/StackStorm/st2/pulls/3762","id":142703892,"html_url":"https://github.com/StackStorm/st2/pull/3762","diff_url":"https://github.com/StackStorm/st2/pull/3762.diff","patch_url":"https://github.com/StackStorm/st2/pull/3762.patch","issue_url":"https://api.github.com/repos/StackStorm/st2/issues/3762","number":3762,"state":"open","locked":false,"title":"[WIP] Garbage Collection for Inquiries","user":{"login":"Mierdin","id":4230395,"avatar_url":"https://avatars0.githubusercontent.com/u/4230395?v=4","gravatar_id":"","url":"https://api.github.com/users/Mierdin","html_url":"https://github.com/Mierdin","followers_url":"https://api.github.com/users/Mierdin/followers","following_url":"https://api.github.com/users/Mierdin/following{/other_user}","gists_url":"https://api.github.com/users/Mierdin/gists{/gist_id}","starred_url":"https://api.github.com/users/Mierdin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mierdin/subscriptions","organizations_url":"https://api.github.com/users/Mierdin/orgs","repos_url":"https://api.github.com/users/Mierdin/repos","events_url":"https://api.github.com/users/Mierdin/events{/privacy}","received_events_url":"https://api.github.com/users/Mierdin/received_events","type":"User","site_admin":false},"body":"> Do not merge before https://github.com/StackStorm/st2/pull/3653 - contains commits from that branch\r\n\r\nThis PR introduces GC for Inquiries. Inquiries are GC'd a little differently than other StackStorm resources, in that they each have their own individual TTL value (which defaults to 24 hours/1440 minutes).\r\n\r\nA new configuration option has been added, but instead of an integer, this field is `boolean`, to indicate whether or not GC for any Inquiries should be performed (`False` by default). If explicitly enabled, only Inquiries that have exceeded their own TTL value will be cleaned up.\r\n\r\nIn addition, the way Inquiries are cleaned up is a bit different too. Instead of being deleted, an Inquiry that exceeds its TTL will be marked as failed, and any workflow(s) it is a part of will be instructed to resume. This places the control back in the workflow on how to proceed if an Inquiry fails.\r\n\r\n# TODO\r\n\r\n- [ ] Figure out config issue under itests\r\n","created_at":"2017-09-23T07:14:34Z","updated_at":"2017-09-26T09:15:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e3a68c44f2b8a1ce79c6de64cce65352ce6af3b","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/StackStorm/st2/pulls/3762/commits","review_comments_url":"https://api.github.com/repos/StackStorm/st2/pulls/3762/comments","review_comment_url":"https://api.github.com/repos/StackStorm/st2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/StackStorm/st2/issues/3762/comments","statuses_url":"https://api.github.com/repos/StackStorm/st2/statuses/59cdaffe3d1370c6d9f294807fd0e18804eb6280","head":{"label":"StackStorm:inquiry-garbage-collection","ref":"inquiry-garbage-collection","sha":"59cdaffe3d1370c6d9f294807fd0e18804eb6280","user":{"login":"StackStorm","id":4969009,"avatar_url":"https://avatars3.githubusercontent.com/u/4969009?v=4","gravatar_id":"","url":"https://api.github.com/users/StackStorm","html_url":"https://github.com/StackStorm","followers_url":"https://api.github.com/users/StackStorm/followers","following_url":"https://api.github.com/users/StackStorm/following{/other_user}","gists_url":"https://api.github.com/users/StackStorm/gists{/gist_id}","starred_url":"https://api.github.com/users/StackStorm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StackStorm/subscriptions","organizations_url":"https://api.github.com/users/StackStorm/orgs","repos_url":"https://api.github.com/users/StackStorm/repos","events_url":"https://api.github.com/users/StackStorm/events{/privacy}","received_events_url":"https://api.github.com/users/StackStorm/received_events","type":"Organization","site_admin":false},"repo":{"id":19051806,"name":"st2","full_name":"StackStorm/st2","owner":{"login":"StackStorm","id":4969009,"avatar_url":"https://avatars3.githubusercontent.com/u/4969009?v=4","gravatar_id":"","url":"https://api.github.com/users/StackStorm","html_url":"https://github.com/StackStorm","followers_url":"https://api.github.com/users/StackStorm/followers","following_url":"https://api.github.com/users/StackStorm/following{/other_user}","gists_url":"https://api.github.com/users/StackStorm/gists{/gist_id}","starred_url":"https://api.github.com/users/StackStorm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StackStorm/subscriptions","organizations_url":"https://api.github.com/users/StackStorm/orgs","repos_url":"https://api.github.com/users/StackStorm/repos","events_url":"https://api.github.com/users/StackStorm/events{/privacy}","received_events_url":"https://api.github.com/users/StackStorm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StackStorm/st2","description":"StackStorm (aka \"IFTTT for Ops\") is event-driven automation commonly used for auto-remediation, security responses, facilitated troubleshooting, complex deployments, and more. Includes rules engine, workflow, 1800+ integrations (see https://exchange.stackstorm.org), native ChatOps and so forth. Installer available at http://docs.stackstorm.com/install/index.html. Ping us on slack - https://stackstorm-community.slack.com/.","fork":false,"url":"https://api.github.com/repos/StackStorm/st2","forks_url":"https://api.github.com/repos/StackStorm/st2/forks","keys_url":"https://api.github.com/repos/StackStorm/st2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StackStorm/st2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StackStorm/st2/teams","hooks_url":"https://api.github.com/repos/StackStorm/st2/hooks","issue_events_url":"https://api.github.com/repos/StackStorm/st2/issues/events{/number}","events_url":"https://api.github.com/repos/StackStorm/st2/events","assignees_url":"https://api.github.com/repos/StackStorm/st2/assignees{/user}","branches_url":"https://api.github.com/repos/StackStorm/st2/branches{/branch}","tags_url":"https://api.github.com/repos/StackStorm/st2/tags","blobs_url":"https://api.github.com/repos/StackStorm/st2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StackStorm/st2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StackStorm/st2/git/refs{/sha}","trees_url":"https://api.github.com/repos/StackStorm/st2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StackStorm/st2/statuses/{sha}","languages_url":"https://api.github.com/repos/StackStorm/st2/languages","stargazers_url":"https://api.github.com/repos/StackStorm/st2/stargazers","contributors_url":"https://api.github.com/repos/StackStorm/st2/contributors","subscribers_url":"https://api.github.com/repos/StackStorm/st2/subscribers","subscription_url":"https://api.github.com/repos/StackStorm/st2/subscription","commits_url":"https://api.github.com/repos/StackStorm/st2/commits{/sha}","git_commits_url":"https://api.github.com/repos/StackStorm/st2/git/commits{/sha}","comments_url":"https://api.github.com/repos/StackStorm/st2/comments{/number}","issue_comment_url":"https://api.github.com/repos/StackStorm/st2/issues/comments{/number}","contents_url":"https://api.github.com/repos/StackStorm/st2/contents/{+path}","compare_url":"https://api.github.com/repos/StackStorm/st2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StackStorm/st2/merges","archive_url":"https://api.github.com/repos/StackStorm/st2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StackStorm/st2/downloads","issues_url":"https://api.github.com/repos/StackStorm/st2/issues{/number}","pulls_url":"https://api.github.com/repos/StackStorm/st2/pulls{/number}","milestones_url":"https://api.github.com/repos/StackStorm/st2/milestones{/number}","notifications_url":"https://api.github.com/repos/StackStorm/st2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StackStorm/st2/labels{/name}","releases_url":"https://api.github.com/repos/StackStorm/st2/releases{/id}","deployments_url":"https://api.github.com/repos/StackStorm/st2/deployments","created_at":"2014-04-23T00:51:34Z","updated_at":"2017-09-26T08:13:04Z","pushed_at":"2017-09-26T08:28:12Z","git_url":"git://github.com/StackStorm/st2.git","ssh_url":"git@github.com:StackStorm/st2.git","clone_url":"https://github.com/StackStorm/st2.git","svn_url":"https://github.com/StackStorm/st2","homepage":"http://www.stackstorm.com/","size":21514,"stargazers_count":2233,"watchers_count":2233,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":293,"mirror_url":null,"open_issues_count":292,"forks":293,"open_issues":292,"watchers":2233,"default_branch":"master"}},"base":{"label":"StackStorm:api-ask-response","ref":"api-ask-response","sha":"b588b14dabf49362dc48db1689be02728ee9784d","user":{"login":"StackStorm","id":4969009,"avatar_url":"https://avatars3.githubusercontent.com/u/4969009?v=4","gravatar_id":"","url":"https://api.github.com/users/StackStorm","html_url":"https://github.com/StackStorm","followers_url":"https://api.github.com/users/StackStorm/followers","following_url":"https://api.github.com/users/StackStorm/following{/other_user}","gists_url":"https://api.github.com/users/StackStorm/gists{/gist_id}","starred_url":"https://api.github.com/users/StackStorm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StackStorm/subscriptions","organizations_url":"https://api.github.com/users/StackStorm/orgs","repos_url":"https://api.github.com/users/StackStorm/repos","events_url":"https://api.github.com/users/StackStorm/events{/privacy}","received_events_url":"https://api.github.com/users/StackStorm/received_events","type":"Organization","site_admin":false},"repo":{"id":19051806,"name":"st2","full_name":"StackStorm/st2","owner":{"login":"StackStorm","id":4969009,"avatar_url":"https://avatars3.githubusercontent.com/u/4969009?v=4","gravatar_id":"","url":"https://api.github.com/users/StackStorm","html_url":"https://github.com/StackStorm","followers_url":"https://api.github.com/users/StackStorm/followers","following_url":"https://api.github.com/users/StackStorm/following{/other_user}","gists_url":"https://api.github.com/users/StackStorm/gists{/gist_id}","starred_url":"https://api.github.com/users/StackStorm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StackStorm/subscriptions","organizations_url":"https://api.github.com/users/StackStorm/orgs","repos_url":"https://api.github.com/users/StackStorm/repos","events_url":"https://api.github.com/users/StackStorm/events{/privacy}","received_events_url":"https://api.github.com/users/StackStorm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StackStorm/st2","description":"StackStorm (aka \"IFTTT for Ops\") is event-driven automation commonly used for auto-remediation, security responses, facilitated troubleshooting, complex deployments, and more. Includes rules engine, workflow, 1800+ integrations (see https://exchange.stackstorm.org), native ChatOps and so forth. Installer available at http://docs.stackstorm.com/install/index.html. Ping us on slack - https://stackstorm-community.slack.com/.","fork":false,"url":"https://api.github.com/repos/StackStorm/st2","forks_url":"https://api.github.com/repos/StackStorm/st2/forks","keys_url":"https://api.github.com/repos/StackStorm/st2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StackStorm/st2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StackStorm/st2/teams","hooks_url":"https://api.github.com/repos/StackStorm/st2/hooks","issue_events_url":"https://api.github.com/repos/StackStorm/st2/issues/events{/number}","events_url":"https://api.github.com/repos/StackStorm/st2/events","assignees_url":"https://api.github.com/repos/StackStorm/st2/assignees{/user}","branches_url":"https://api.github.com/repos/StackStorm/st2/branches{/branch}","tags_url":"https://api.github.com/repos/StackStorm/st2/tags","blobs_url":"https://api.github.com/repos/StackStorm/st2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StackStorm/st2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StackStorm/st2/git/refs{/sha}","trees_url":"https://api.github.com/repos/StackStorm/st2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StackStorm/st2/statuses/{sha}","languages_url":"https://api.github.com/repos/StackStorm/st2/languages","stargazers_url":"https://api.github.com/repos/StackStorm/st2/stargazers","contributors_url":"https://api.github.com/repos/StackStorm/st2/contributors","subscribers_url":"https://api.github.com/repos/StackStorm/st2/subscribers","subscription_url":"https://api.github.com/repos/StackStorm/st2/subscription","commits_url":"https://api.github.com/repos/StackStorm/st2/commits{/sha}","git_commits_url":"https://api.github.com/repos/StackStorm/st2/git/commits{/sha}","comments_url":"https://api.github.com/repos/StackStorm/st2/comments{/number}","issue_comment_url":"https://api.github.com/repos/StackStorm/st2/issues/comments{/number}","contents_url":"https://api.github.com/repos/StackStorm/st2/contents/{+path}","compare_url":"https://api.github.com/repos/StackStorm/st2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StackStorm/st2/merges","archive_url":"https://api.github.com/repos/StackStorm/st2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StackStorm/st2/downloads","issues_url":"https://api.github.com/repos/StackStorm/st2/issues{/number}","pulls_url":"https://api.github.com/repos/StackStorm/st2/pulls{/number}","milestones_url":"https://api.github.com/repos/StackStorm/st2/milestones{/number}","notifications_url":"https://api.github.com/repos/StackStorm/st2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StackStorm/st2/labels{/name}","releases_url":"https://api.github.com/repos/StackStorm/st2/releases{/id}","deployments_url":"https://api.github.com/repos/StackStorm/st2/deployments","created_at":"2014-04-23T00:51:34Z","updated_at":"2017-09-26T08:13:04Z","pushed_at":"2017-09-26T08:28:12Z","git_url":"git://github.com/StackStorm/st2.git","ssh_url":"git@github.com:StackStorm/st2.git","clone_url":"https://github.com/StackStorm/st2.git","svn_url":"https://github.com/StackStorm/st2","homepage":"http://www.stackstorm.com/","size":21514,"stargazers_count":2233,"watchers_count":2233,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":293,"mirror_url":null,"open_issues_count":292,"forks":293,"open_issues":292,"watchers":2233,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/StackStorm/st2/pulls/3762"},"html":{"href":"https://github.com/StackStorm/st2/pull/3762"},"issue":{"href":"https://api.github.com/repos/StackStorm/st2/issues/3762"},"comments":{"href":"https://api.github.com/repos/StackStorm/st2/issues/3762/comments"},"review_comments":{"href":"https://api.github.com/repos/StackStorm/st2/pulls/3762/comments"},"review_comment":{"href":"https://api.github.com/repos/StackStorm/st2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/StackStorm/st2/pulls/3762/commits"},"statuses":{"href":"https://api.github.com/repos/StackStorm/st2/statuses/59cdaffe3d1370c6d9f294807fd0e18804eb6280"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Kami"}}