{"action":"created","comment":{"url":"https://api.github.com/repos/Financial-Times/next-myft-api/pulls/comments/38438140","id":38438140,"diff_hunk":"@@ -0,0 +1,101 @@\n+'use strict';\n+\n+const worker = require('@financial-times/n-worker');\n+const AWS = require('../server/lib/aws-connect').AWS;\n+const db = require('../server/utils/db');\n+const Directly = require('directly');\n+\n+const sqs = new AWS.SQS();\n+const historyQueue = process.env.SQS_HISTORY;\n+\n+function generateConcept(event) {\n+\treturn function(concept, i) {\n+\t\tevent[`concept${i}`] = concept;\n+\t\treturn `MERGE (concept${i}:Concept {uuid: {concept${i}}.uuid})\n+\t\t\t\tON CREATE SET concept${i} += {concept${i}}\n+\t\t\t\tON MATCH SET concept${i} += {concept${i}}\n+\t\t\t\tMERGE (user)-[viewed${i}:viewed]->(concept${i})\n+\t\t\t\tON CREATE SET viewed${i}.count = {count}, viewed${i}.created = {created}, viewed${i}.updated = {updated}\n+\t\t\t\tON MATCH SET viewed${i}.count = viewed${i}.count + {count}, viewed${i}.updated = {updated}`;","path":"jobs/history.js","position":19,"original_position":19,"commit_id":"a621545abdb5a04eba03d06283d95386f2f800f0","original_commit_id":"a621545abdb5a04eba03d06283d95386f2f800f0","user":{"login":"phamann","id":80089,"avatar_url":"https://avatars.githubusercontent.com/u/80089?v=3","gravatar_id":"","url":"https://api.github.com/users/phamann","html_url":"https://github.com/phamann","followers_url":"https://api.github.com/users/phamann/followers","following_url":"https://api.github.com/users/phamann/following{/other_user}","gists_url":"https://api.github.com/users/phamann/gists{/gist_id}","starred_url":"https://api.github.com/users/phamann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phamann/subscriptions","organizations_url":"https://api.github.com/users/phamann/orgs","repos_url":"https://api.github.com/users/phamann/repos","events_url":"https://api.github.com/users/phamann/events{/privacy}","received_events_url":"https://api.github.com/users/phamann/received_events","type":"User","site_admin":false},"body":"It is :smiley: ","created_at":"2015-09-01T16:13:14Z","updated_at":"2015-09-01T16:13:14Z","html_url":"https://github.com/Financial-Times/next-myft-api/pull/19#discussion_r38438140","pull_request_url":"https://api.github.com/repos/Financial-Times/next-myft-api/pulls/19","_links":{"self":{"href":"https://api.github.com/repos/Financial-Times/next-myft-api/pulls/comments/38438140"},"html":{"href":"https://github.com/Financial-Times/next-myft-api/pull/19#discussion_r38438140"},"pull_request":{"href":"https://api.github.com/repos/Financial-Times/next-myft-api/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/Financial-Times/next-myft-api/pulls/19","id":43892538,"html_url":"https://github.com/Financial-Times/next-myft-api/pull/19","diff_url":"https://github.com/Financial-Times/next-myft-api/pull/19.diff","patch_url":"https://github.com/Financial-Times/next-myft-api/pull/19.patch","issue_url":"https://api.github.com/repos/Financial-Times/next-myft-api/issues/19","number":19,"state":"closed","locked":false,"title":"History worker","user":{"login":"phamann","id":80089,"avatar_url":"https://avatars.githubusercontent.com/u/80089?v=3","gravatar_id":"","url":"https://api.github.com/users/phamann","html_url":"https://github.com/phamann","followers_url":"https://api.github.com/users/phamann/followers","following_url":"https://api.github.com/users/phamann/following{/other_user}","gists_url":"https://api.github.com/users/phamann/gists{/gist_id}","starred_url":"https://api.github.com/users/phamann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phamann/subscriptions","organizations_url":"https://api.github.com/users/phamann/orgs","repos_url":"https://api.github.com/users/phamann/repos","events_url":"https://api.github.com/users/phamann/events{/privacy}","received_events_url":"https://api.github.com/users/phamann/received_events","type":"User","site_admin":false},"body":"Adds new worker process to poll history SQS queue and post to DB in batches.\r\n\r\n/cc @adgad @wheresrhys @Lrnk ","created_at":"2015-09-01T15:50:15Z","updated_at":"2015-09-01T16:13:14Z","closed_at":"2015-09-01T16:12:39Z","merged_at":"2015-09-01T16:12:39Z","merge_commit_sha":"1c8111738f65ac0ca98a183d43786a5429ae1b5d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Financial-Times/next-myft-api/pulls/19/commits","review_comments_url":"https://api.github.com/repos/Financial-Times/next-myft-api/pulls/19/comments","review_comment_url":"https://api.github.com/repos/Financial-Times/next-myft-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Financial-Times/next-myft-api/issues/19/comments","statuses_url":"https://api.github.com/repos/Financial-Times/next-myft-api/statuses/a621545abdb5a04eba03d06283d95386f2f800f0","head":{"label":"Financial-Times:history-worker","ref":"history-worker","sha":"a621545abdb5a04eba03d06283d95386f2f800f0","user":{"login":"Financial-Times","id":3502508,"avatar_url":"https://avatars.githubusercontent.com/u/3502508?v=3","gravatar_id":"","url":"https://api.github.com/users/Financial-Times","html_url":"https://github.com/Financial-Times","followers_url":"https://api.github.com/users/Financial-Times/followers","following_url":"https://api.github.com/users/Financial-Times/following{/other_user}","gists_url":"https://api.github.com/users/Financial-Times/gists{/gist_id}","starred_url":"https://api.github.com/users/Financial-Times/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Financial-Times/subscriptions","organizations_url":"https://api.github.com/users/Financial-Times/orgs","repos_url":"https://api.github.com/users/Financial-Times/repos","events_url":"https://api.github.com/users/Financial-Times/events{/privacy}","received_events_url":"https://api.github.com/users/Financial-Times/received_events","type":"Organization","site_admin":false},"repo":{"id":40488712,"name":"next-myft-api","full_name":"Financial-Times/next-myft-api","owner":{"login":"Financial-Times","id":3502508,"avatar_url":"https://avatars.githubusercontent.com/u/3502508?v=3","gravatar_id":"","url":"https://api.github.com/users/Financial-Times","html_url":"https://github.com/Financial-Times","followers_url":"https://api.github.com/users/Financial-Times/followers","following_url":"https://api.github.com/users/Financial-Times/following{/other_user}","gists_url":"https://api.github.com/users/Financial-Times/gists{/gist_id}","starred_url":"https://api.github.com/users/Financial-Times/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Financial-Times/subscriptions","organizations_url":"https://api.github.com/users/Financial-Times/orgs","repos_url":"https://api.github.com/users/Financial-Times/repos","events_url":"https://api.github.com/users/Financial-Times/events{/privacy}","received_events_url":"https://api.github.com/users/Financial-Times/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Financial-Times/next-myft-api","description":"Playground for experimenting with a Neo4j backed implementation of the myFT API","fork":false,"url":"https://api.github.com/repos/Financial-Times/next-myft-api","forks_url":"https://api.github.com/repos/Financial-Times/next-myft-api/forks","keys_url":"https://api.github.com/repos/Financial-Times/next-myft-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Financial-Times/next-myft-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Financial-Times/next-myft-api/teams","hooks_url":"https://api.github.com/repos/Financial-Times/next-myft-api/hooks","issue_events_url":"https://api.github.com/repos/Financial-Times/next-myft-api/issues/events{/number}","events_url":"https://api.github.com/repos/Financial-Times/next-myft-api/events","assignees_url":"https://api.github.com/repos/Financial-Times/next-myft-api/assignees{/user}","branches_url":"https://api.github.com/repos/Financial-Times/next-myft-api/branches{/branch}","tags_url":"https://api.github.com/repos/Financial-Times/next-myft-api/tags","blobs_url":"https://api.github.com/repos/Financial-Times/next-myft-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Financial-Times/next-myft-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Financial-Times/next-myft-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/Financial-Times/next-myft-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Financial-Times/next-myft-api/statuses/{sha}","languages_url":"https://api.github.com/repos/Financial-Times/next-myft-api/languages","stargazers_url":"https://api.github.com/repos/Financial-Times/next-myft-api/stargazers","contributors_url":"https://api.github.com/repos/Financial-Times/next-myft-api/contributors","subscribers_url":"https://api.github.com/repos/Financial-Times/next-myft-api/subscribers","subscription_url":"https://api.github.com/repos/Financial-Times/next-myft-api/subscription","commits_url":"https://api.github.com/repos/Financial-Times/next-myft-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/Financial-Times/next-myft-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/Financial-Times/next-myft-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/Financial-Times/next-myft-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/Financial-Times/next-myft-api/contents/{+path}","compare_url":"https://api.github.com/repos/Financial-Times/next-myft-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Financial-Times/next-myft-api/merges","archive_url":"https://api.github.com/repos/Financial-Times/next-myft-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Financial-Times/next-myft-api/downloads","issues_url":"https://api.github.com/repos/Financial-Times/next-myft-api/issues{/number}","pulls_url":"https://api.github.com/repos/Financial-Times/next-myft-api/pulls{/number}","milestones_url":"https://api.github.com/repos/Financial-Times/next-myft-api/milestones{/number}","notifications_url":"https://api.github.com/repos/Financial-Times/next-myft-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Financial-Times/next-myft-api/labels{/name}","releases_url":"https://api.github.com/repos/Financial-Times/next-myft-api/releases{/id}","created_at":"2015-08-10T15:00:26Z","updated_at":"2015-08-12T10:40:48Z","pushed_at":"2015-09-01T16:12:40Z","git_url":"git://github.com/Financial-Times/next-myft-api.git","ssh_url":"git@github.com:Financial-Times/next-myft-api.git","clone_url":"https://github.com/Financial-Times/next-myft-api.git","svn_url":"https://github.com/Financial-Times/next-myft-api","homepage":null,"size":476,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Financial-Times:master","ref":"master","sha":"edf6b5228530c4dbe3a22b0f5eee2a8e49c345fb","user":{"login":"Financial-Times","id":3502508,"avatar_url":"https://avatars.githubusercontent.com/u/3502508?v=3","gravatar_id":"","url":"https://api.github.com/users/Financial-Times","html_url":"https://github.com/Financial-Times","followers_url":"https://api.github.com/users/Financial-Times/followers","following_url":"https://api.github.com/users/Financial-Times/following{/other_user}","gists_url":"https://api.github.com/users/Financial-Times/gists{/gist_id}","starred_url":"https://api.github.com/users/Financial-Times/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Financial-Times/subscriptions","organizations_url":"https://api.github.com/users/Financial-Times/orgs","repos_url":"https://api.github.com/users/Financial-Times/repos","events_url":"https://api.github.com/users/Financial-Times/events{/privacy}","received_events_url":"https://api.github.com/users/Financial-Times/received_events","type":"Organization","site_admin":false},"repo":{"id":40488712,"name":"next-myft-api","full_name":"Financial-Times/next-myft-api","owner":{"login":"Financial-Times","id":3502508,"avatar_url":"https://avatars.githubusercontent.com/u/3502508?v=3","gravatar_id":"","url":"https://api.github.com/users/Financial-Times","html_url":"https://github.com/Financial-Times","followers_url":"https://api.github.com/users/Financial-Times/followers","following_url":"https://api.github.com/users/Financial-Times/following{/other_user}","gists_url":"https://api.github.com/users/Financial-Times/gists{/gist_id}","starred_url":"https://api.github.com/users/Financial-Times/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Financial-Times/subscriptions","organizations_url":"https://api.github.com/users/Financial-Times/orgs","repos_url":"https://api.github.com/users/Financial-Times/repos","events_url":"https://api.github.com/users/Financial-Times/events{/privacy}","received_events_url":"https://api.github.com/users/Financial-Times/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Financial-Times/next-myft-api","description":"Playground for experimenting with a Neo4j backed implementation of the myFT API","fork":false,"url":"https://api.github.com/repos/Financial-Times/next-myft-api","forks_url":"https://api.github.com/repos/Financial-Times/next-myft-api/forks","keys_url":"https://api.github.com/repos/Financial-Times/next-myft-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Financial-Times/next-myft-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Financial-Times/next-myft-api/teams","hooks_url":"https://api.github.com/repos/Financial-Times/next-myft-api/hooks","issue_events_url":"https://api.github.com/repos/Financial-Times/next-myft-api/issues/events{/number}","events_url":"https://api.github.com/repos/Financial-Times/next-myft-api/events","assignees_url":"https://api.github.com/repos/Financial-Times/next-myft-api/assignees{/user}","branches_url":"https://api.github.com/repos/Financial-Times/next-myft-api/branches{/branch}","tags_url":"https://api.github.com/repos/Financial-Times/next-myft-api/tags","blobs_url":"https://api.github.com/repos/Financial-Times/next-myft-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Financial-Times/next-myft-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Financial-Times/next-myft-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/Financial-Times/next-myft-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Financial-Times/next-myft-api/statuses/{sha}","languages_url":"https://api.github.com/repos/Financial-Times/next-myft-api/languages","stargazers_url":"https://api.github.com/repos/Financial-Times/next-myft-api/stargazers","contributors_url":"https://api.github.com/repos/Financial-Times/next-myft-api/contributors","subscribers_url":"https://api.github.com/repos/Financial-Times/next-myft-api/subscribers","subscription_url":"https://api.github.com/repos/Financial-Times/next-myft-api/subscription","commits_url":"https://api.github.com/repos/Financial-Times/next-myft-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/Financial-Times/next-myft-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/Financial-Times/next-myft-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/Financial-Times/next-myft-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/Financial-Times/next-myft-api/contents/{+path}","compare_url":"https://api.github.com/repos/Financial-Times/next-myft-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Financial-Times/next-myft-api/merges","archive_url":"https://api.github.com/repos/Financial-Times/next-myft-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Financial-Times/next-myft-api/downloads","issues_url":"https://api.github.com/repos/Financial-Times/next-myft-api/issues{/number}","pulls_url":"https://api.github.com/repos/Financial-Times/next-myft-api/pulls{/number}","milestones_url":"https://api.github.com/repos/Financial-Times/next-myft-api/milestones{/number}","notifications_url":"https://api.github.com/repos/Financial-Times/next-myft-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Financial-Times/next-myft-api/labels{/name}","releases_url":"https://api.github.com/repos/Financial-Times/next-myft-api/releases{/id}","created_at":"2015-08-10T15:00:26Z","updated_at":"2015-08-12T10:40:48Z","pushed_at":"2015-09-01T16:12:40Z","git_url":"git://github.com/Financial-Times/next-myft-api.git","ssh_url":"git@github.com:Financial-Times/next-myft-api.git","clone_url":"https://github.com/Financial-Times/next-myft-api.git","svn_url":"https://github.com/Financial-Times/next-myft-api","homepage":null,"size":476,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Financial-Times/next-myft-api/pulls/19"},"html":{"href":"https://github.com/Financial-Times/next-myft-api/pull/19"},"issue":{"href":"https://api.github.com/repos/Financial-Times/next-myft-api/issues/19"},"comments":{"href":"https://api.github.com/repos/Financial-Times/next-myft-api/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/Financial-Times/next-myft-api/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/Financial-Times/next-myft-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Financial-Times/next-myft-api/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/Financial-Times/next-myft-api/statuses/a621545abdb5a04eba03d06283d95386f2f800f0"}}}}