{"action":"created","comment":{"url":"https://api.github.com/repos/juancampa/membrane-driver-github/pulls/comments/211043062","pull_request_review_id":147393894,"id":211043062,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMTA0MzA2Mg==","diff_hunk":"@@ -283,28 +286,84 @@ export const Config = {\n }\n \n export async function timer({ key }) {\n+  const { state } = program;\n   const [ owner, repo ] = key.split('/')\n-  const result = await  client.activity.getEventsForRepo({ owner, repo });\n-    for (let event of result.data) {\n-      const { type, payload} = event;\n-      if (type === 'IssuesEvent' && payload.action === 'opened') {\n-        \n-        // dispatch Event\n-        const repoRef = root.users.one({ name: owner }).repos.one({ name: repo })\n-        await repoRef.issueOpened.dispatch({\n-          issue: repoRef.issues.one({ number: payload.issue.number })\n-        });\n-      };\n-      if (type === 'PullRequestEvent' && payload.action === 'opened') {\n-\n-        // dispatch Event\n-        const repoRef = root.users.one({ name: owner }).repos.one({ name: repo })\n-        await repoRef.pullRequestOpened.dispatch({\n-            issue: repoRef.issues.one({ number: payload.pull_request.number }),\n-            pullRequest: repoRef.pullRequests.one({ number: payload.pull_request.number })\n-        });\n+  const result = await client.activity.getEventsForRepo({ owner, repo });\n+\n+  const data = result.data.reverse();\n+  \n+  const index = data\n+    .findIndex(item => formatTime(item.created_at) > state.repos[key].lastEventTime);\n+\n+  const newEvents = data.splice(index);","path":"index.js","position":80,"original_position":80,"commit_id":"614746d787b1ba39ba660b88022409b7f8d5b441","original_commit_id":"614746d787b1ba39ba660b88022409b7f8d5b441","user":{"login":"juancampa","id":1410520,"node_id":"MDQ6VXNlcjE0MTA1MjA=","avatar_url":"https://avatars2.githubusercontent.com/u/1410520?v=4","gravatar_id":"","url":"https://api.github.com/users/juancampa","html_url":"https://github.com/juancampa","followers_url":"https://api.github.com/users/juancampa/followers","following_url":"https://api.github.com/users/juancampa/following{/other_user}","gists_url":"https://api.github.com/users/juancampa/gists{/gist_id}","starred_url":"https://api.github.com/users/juancampa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juancampa/subscriptions","organizations_url":"https://api.github.com/users/juancampa/orgs","repos_url":"https://api.github.com/users/juancampa/repos","events_url":"https://api.github.com/users/juancampa/events{/privacy}","received_events_url":"https://api.github.com/users/juancampa/received_events","type":"User","site_admin":false},"body":"Also, is better to reverse the filtered collection which will be, in many cases, many times smaller or even empty","created_at":"2018-08-17T22:05:02Z","updated_at":"2018-08-17T22:10:13Z","html_url":"https://github.com/juancampa/membrane-driver-github/pull/6#discussion_r211043062","pull_request_url":"https://api.github.com/repos/juancampa/membrane-driver-github/pulls/6","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/juancampa/membrane-driver-github/pulls/comments/211043062"},"html":{"href":"https://github.com/juancampa/membrane-driver-github/pull/6#discussion_r211043062"},"pull_request":{"href":"https://api.github.com/repos/juancampa/membrane-driver-github/pulls/6"}},"in_reply_to_id":211042782},"pull_request":{"url":"https://api.github.com/repos/juancampa/membrane-driver-github/pulls/6","id":209170813,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA5MTcwODEz","html_url":"https://github.com/juancampa/membrane-driver-github/pull/6","diff_url":"https://github.com/juancampa/membrane-driver-github/pull/6.diff","patch_url":"https://github.com/juancampa/membrane-driver-github/pull/6.patch","issue_url":"https://api.github.com/repos/juancampa/membrane-driver-github/issues/6","number":6,"state":"open","locked":false,"title":"Fix timer","user":{"login":"aranajhonny","id":9091881,"node_id":"MDQ6VXNlcjkwOTE4ODE=","avatar_url":"https://avatars1.githubusercontent.com/u/9091881?v=4","gravatar_id":"","url":"https://api.github.com/users/aranajhonny","html_url":"https://github.com/aranajhonny","followers_url":"https://api.github.com/users/aranajhonny/followers","following_url":"https://api.github.com/users/aranajhonny/following{/other_user}","gists_url":"https://api.github.com/users/aranajhonny/gists{/gist_id}","starred_url":"https://api.github.com/users/aranajhonny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aranajhonny/subscriptions","organizations_url":"https://api.github.com/users/aranajhonny/orgs","repos_url":"https://api.github.com/users/aranajhonny/repos","events_url":"https://api.github.com/users/aranajhonny/events{/privacy}","received_events_url":"https://api.github.com/users/aranajhonny/received_events","type":"User","site_admin":false},"body":"#2 ","created_at":"2018-08-17T14:46:45Z","updated_at":"2018-08-17T22:10:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8cabc968e98bb848c04a71a5960c0e588983e4c6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/juancampa/membrane-driver-github/pulls/6/commits","review_comments_url":"https://api.github.com/repos/juancampa/membrane-driver-github/pulls/6/comments","review_comment_url":"https://api.github.com/repos/juancampa/membrane-driver-github/pulls/comments{/number}","comments_url":"https://api.github.com/repos/juancampa/membrane-driver-github/issues/6/comments","statuses_url":"https://api.github.com/repos/juancampa/membrane-driver-github/statuses/614746d787b1ba39ba660b88022409b7f8d5b441","head":{"label":"aranajhonny:master","ref":"master","sha":"614746d787b1ba39ba660b88022409b7f8d5b441","user":{"login":"aranajhonny","id":9091881,"node_id":"MDQ6VXNlcjkwOTE4ODE=","avatar_url":"https://avatars1.githubusercontent.com/u/9091881?v=4","gravatar_id":"","url":"https://api.github.com/users/aranajhonny","html_url":"https://github.com/aranajhonny","followers_url":"https://api.github.com/users/aranajhonny/followers","following_url":"https://api.github.com/users/aranajhonny/following{/other_user}","gists_url":"https://api.github.com/users/aranajhonny/gists{/gist_id}","starred_url":"https://api.github.com/users/aranajhonny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aranajhonny/subscriptions","organizations_url":"https://api.github.com/users/aranajhonny/orgs","repos_url":"https://api.github.com/users/aranajhonny/repos","events_url":"https://api.github.com/users/aranajhonny/events{/privacy}","received_events_url":"https://api.github.com/users/aranajhonny/received_events","type":"User","site_admin":false},"repo":{"id":145035200,"node_id":"MDEwOlJlcG9zaXRvcnkxNDUwMzUyMDA=","name":"membrane-driver-github","full_name":"aranajhonny/membrane-driver-github","owner":{"login":"aranajhonny","id":9091881,"node_id":"MDQ6VXNlcjkwOTE4ODE=","avatar_url":"https://avatars1.githubusercontent.com/u/9091881?v=4","gravatar_id":"","url":"https://api.github.com/users/aranajhonny","html_url":"https://github.com/aranajhonny","followers_url":"https://api.github.com/users/aranajhonny/followers","following_url":"https://api.github.com/users/aranajhonny/following{/other_user}","gists_url":"https://api.github.com/users/aranajhonny/gists{/gist_id}","starred_url":"https://api.github.com/users/aranajhonny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aranajhonny/subscriptions","organizations_url":"https://api.github.com/users/aranajhonny/orgs","repos_url":"https://api.github.com/users/aranajhonny/repos","events_url":"https://api.github.com/users/aranajhonny/events{/privacy}","received_events_url":"https://api.github.com/users/aranajhonny/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aranajhonny/membrane-driver-github","description":null,"fork":true,"url":"https://api.github.com/repos/aranajhonny/membrane-driver-github","forks_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/forks","keys_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/teams","hooks_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/hooks","issue_events_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/issues/events{/number}","events_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/events","assignees_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/assignees{/user}","branches_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/branches{/branch}","tags_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/tags","blobs_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/git/refs{/sha}","trees_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/statuses/{sha}","languages_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/languages","stargazers_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/stargazers","contributors_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/contributors","subscribers_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/subscribers","subscription_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/subscription","commits_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/commits{/sha}","git_commits_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/git/commits{/sha}","comments_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/comments{/number}","issue_comment_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/issues/comments{/number}","contents_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/contents/{+path}","compare_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/merges","archive_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/downloads","issues_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/issues{/number}","pulls_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/pulls{/number}","milestones_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/milestones{/number}","notifications_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/labels{/name}","releases_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/releases{/id}","deployments_url":"https://api.github.com/repos/aranajhonny/membrane-driver-github/deployments","created_at":"2018-08-16T20:18:12Z","updated_at":"2018-08-17T21:42:57Z","pushed_at":"2018-08-17T21:42:56Z","git_url":"git://github.com/aranajhonny/membrane-driver-github.git","ssh_url":"git@github.com:aranajhonny/membrane-driver-github.git","clone_url":"https://github.com/aranajhonny/membrane-driver-github.git","svn_url":"https://github.com/aranajhonny/membrane-driver-github","homepage":null,"size":108,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"juancampa:master","ref":"master","sha":"0ba3295910a67a70efa473fd7d106a51cfe9eeb4","user":{"login":"juancampa","id":1410520,"node_id":"MDQ6VXNlcjE0MTA1MjA=","avatar_url":"https://avatars2.githubusercontent.com/u/1410520?v=4","gravatar_id":"","url":"https://api.github.com/users/juancampa","html_url":"https://github.com/juancampa","followers_url":"https://api.github.com/users/juancampa/followers","following_url":"https://api.github.com/users/juancampa/following{/other_user}","gists_url":"https://api.github.com/users/juancampa/gists{/gist_id}","starred_url":"https://api.github.com/users/juancampa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juancampa/subscriptions","organizations_url":"https://api.github.com/users/juancampa/orgs","repos_url":"https://api.github.com/users/juancampa/repos","events_url":"https://api.github.com/users/juancampa/events{/privacy}","received_events_url":"https://api.github.com/users/juancampa/received_events","type":"User","site_admin":false},"repo":{"id":132169008,"node_id":"MDEwOlJlcG9zaXRvcnkxMzIxNjkwMDg=","name":"membrane-driver-github","full_name":"juancampa/membrane-driver-github","owner":{"login":"juancampa","id":1410520,"node_id":"MDQ6VXNlcjE0MTA1MjA=","avatar_url":"https://avatars2.githubusercontent.com/u/1410520?v=4","gravatar_id":"","url":"https://api.github.com/users/juancampa","html_url":"https://github.com/juancampa","followers_url":"https://api.github.com/users/juancampa/followers","following_url":"https://api.github.com/users/juancampa/following{/other_user}","gists_url":"https://api.github.com/users/juancampa/gists{/gist_id}","starred_url":"https://api.github.com/users/juancampa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juancampa/subscriptions","organizations_url":"https://api.github.com/users/juancampa/orgs","repos_url":"https://api.github.com/users/juancampa/repos","events_url":"https://api.github.com/users/juancampa/events{/privacy}","received_events_url":"https://api.github.com/users/juancampa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/juancampa/membrane-driver-github","description":null,"fork":false,"url":"https://api.github.com/repos/juancampa/membrane-driver-github","forks_url":"https://api.github.com/repos/juancampa/membrane-driver-github/forks","keys_url":"https://api.github.com/repos/juancampa/membrane-driver-github/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juancampa/membrane-driver-github/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juancampa/membrane-driver-github/teams","hooks_url":"https://api.github.com/repos/juancampa/membrane-driver-github/hooks","issue_events_url":"https://api.github.com/repos/juancampa/membrane-driver-github/issues/events{/number}","events_url":"https://api.github.com/repos/juancampa/membrane-driver-github/events","assignees_url":"https://api.github.com/repos/juancampa/membrane-driver-github/assignees{/user}","branches_url":"https://api.github.com/repos/juancampa/membrane-driver-github/branches{/branch}","tags_url":"https://api.github.com/repos/juancampa/membrane-driver-github/tags","blobs_url":"https://api.github.com/repos/juancampa/membrane-driver-github/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juancampa/membrane-driver-github/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juancampa/membrane-driver-github/git/refs{/sha}","trees_url":"https://api.github.com/repos/juancampa/membrane-driver-github/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juancampa/membrane-driver-github/statuses/{sha}","languages_url":"https://api.github.com/repos/juancampa/membrane-driver-github/languages","stargazers_url":"https://api.github.com/repos/juancampa/membrane-driver-github/stargazers","contributors_url":"https://api.github.com/repos/juancampa/membrane-driver-github/contributors","subscribers_url":"https://api.github.com/repos/juancampa/membrane-driver-github/subscribers","subscription_url":"https://api.github.com/repos/juancampa/membrane-driver-github/subscription","commits_url":"https://api.github.com/repos/juancampa/membrane-driver-github/commits{/sha}","git_commits_url":"https://api.github.com/repos/juancampa/membrane-driver-github/git/commits{/sha}","comments_url":"https://api.github.com/repos/juancampa/membrane-driver-github/comments{/number}","issue_comment_url":"https://api.github.com/repos/juancampa/membrane-driver-github/issues/comments{/number}","contents_url":"https://api.github.com/repos/juancampa/membrane-driver-github/contents/{+path}","compare_url":"https://api.github.com/repos/juancampa/membrane-driver-github/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juancampa/membrane-driver-github/merges","archive_url":"https://api.github.com/repos/juancampa/membrane-driver-github/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juancampa/membrane-driver-github/downloads","issues_url":"https://api.github.com/repos/juancampa/membrane-driver-github/issues{/number}","pulls_url":"https://api.github.com/repos/juancampa/membrane-driver-github/pulls{/number}","milestones_url":"https://api.github.com/repos/juancampa/membrane-driver-github/milestones{/number}","notifications_url":"https://api.github.com/repos/juancampa/membrane-driver-github/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juancampa/membrane-driver-github/labels{/name}","releases_url":"https://api.github.com/repos/juancampa/membrane-driver-github/releases{/id}","deployments_url":"https://api.github.com/repos/juancampa/membrane-driver-github/deployments","created_at":"2018-05-04T17:20:25Z","updated_at":"2018-08-14T19:49:01Z","pushed_at":"2018-08-17T21:42:57Z","git_url":"git://github.com/juancampa/membrane-driver-github.git","ssh_url":"git@github.com:juancampa/membrane-driver-github.git","clone_url":"https://github.com/juancampa/membrane-driver-github.git","svn_url":"https://github.com/juancampa/membrane-driver-github","homepage":null,"size":61,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":1,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/juancampa/membrane-driver-github/pulls/6"},"html":{"href":"https://github.com/juancampa/membrane-driver-github/pull/6"},"issue":{"href":"https://api.github.com/repos/juancampa/membrane-driver-github/issues/6"},"comments":{"href":"https://api.github.com/repos/juancampa/membrane-driver-github/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/juancampa/membrane-driver-github/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/juancampa/membrane-driver-github/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/juancampa/membrane-driver-github/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/juancampa/membrane-driver-github/statuses/614746d787b1ba39ba660b88022409b7f8d5b441"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"juancampa"}}