{"action":"created","comment":{"url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/pulls/comments/87934772","pull_request_review_id":8524856,"id":87934772,"diff_hunk":"@@ -0,0 +1,70 @@\n+import * as _ from 'lodash';\n+import * as moment from 'moment-timezone';\n+\n+import { SQSClient, SQSMessage } from './clients/sqs';\n+import { SNSClient } from './clients/sns';\n+import { Logger, NoopLogger } from './logger';\n+import { Task } from './';\n+\n+const MAX_RETRY_INTERVAL_SECS = moment.duration(10, 'minutes').asSeconds();\n+const BASE_RETRY_INTERVAL_SECS = moment.duration(30, 'seconds').asSeconds();\n+\n+/*\n+ * Consumes messages from an SQS queue that is subscribed to an SNS topic.\n+ */\n+export abstract class SNSSQSConsumerTask implements Task {\n+  private subscribed:boolean = false;\n+\n+  constructor(private topicName:string,\n+              private snsClient:SNSClient,\n+              private sqsClient:SQSClient,\n+              private baseRetryIntervalSec:number = BASE_RETRY_INTERVAL_SECS,\n+              private maxRetryIntervalSec:number = MAX_RETRY_INTERVAL_SECS,\n+              protected readonly log:Logger = new NoopLogger()) { }\n+\n+  async execute():Promise<boolean> {\n+    if (!this.subscribed) {\n+      await this.subscribeQueueToTopic();","path":"src/sns_sqs_consumer_task.ts","position":null,"original_position":27,"commit_id":"8f149e07631faec4745af25eacd1d062a8418587","original_commit_id":"b52d17b2cbcd09056ca13a56ff36a8984db82eb7","user":{"login":"logandillard","id":20586282,"avatar_url":"https://avatars.githubusercontent.com/u/20586282?v=3","gravatar_id":"","url":"https://api.github.com/users/logandillard","html_url":"https://github.com/logandillard","followers_url":"https://api.github.com/users/logandillard/followers","following_url":"https://api.github.com/users/logandillard/following{/other_user}","gists_url":"https://api.github.com/users/logandillard/gists{/gist_id}","starred_url":"https://api.github.com/users/logandillard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/logandillard/subscriptions","organizations_url":"https://api.github.com/users/logandillard/orgs","repos_url":"https://api.github.com/users/logandillard/repos","events_url":"https://api.github.com/users/logandillard/events{/privacy}","received_events_url":"https://api.github.com/users/logandillard/received_events","type":"User","site_admin":false},"body":"Changed getArn() to getOrCreateArn()","created_at":"2016-11-15T01:56:37Z","updated_at":"2016-11-15T01:56:37Z","html_url":"https://github.com/convoyinc/lib-task-scheduler/pull/3#discussion_r87934772","pull_request_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/convoyinc/lib-task-scheduler/pulls/comments/87934772"},"html":{"href":"https://github.com/convoyinc/lib-task-scheduler/pull/3#discussion_r87934772"},"pull_request":{"href":"https://api.github.com/repos/convoyinc/lib-task-scheduler/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/pulls/3","id":93383637,"html_url":"https://github.com/convoyinc/lib-task-scheduler/pull/3","diff_url":"https://github.com/convoyinc/lib-task-scheduler/pull/3.diff","patch_url":"https://github.com/convoyinc/lib-task-scheduler/pull/3.patch","issue_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/issues/3","number":3,"state":"open","locked":false,"title":"Add findArn to sns","user":{"login":"logandillard","id":20586282,"avatar_url":"https://avatars.githubusercontent.com/u/20586282?v=3","gravatar_id":"","url":"https://api.github.com/users/logandillard","html_url":"https://github.com/logandillard","followers_url":"https://api.github.com/users/logandillard/followers","following_url":"https://api.github.com/users/logandillard/following{/other_user}","gists_url":"https://api.github.com/users/logandillard/gists{/gist_id}","starred_url":"https://api.github.com/users/logandillard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/logandillard/subscriptions","organizations_url":"https://api.github.com/users/logandillard/orgs","repos_url":"https://api.github.com/users/logandillard/repos","events_url":"https://api.github.com/users/logandillard/events{/privacy}","received_events_url":"https://api.github.com/users/logandillard/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-11T19:22:49Z","updated_at":"2016-11-15T01:56:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2624787ad287de29506d2a839c371c5492c10b40","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/pulls/3/commits","review_comments_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/pulls/3/comments","review_comment_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/pulls/comments{/number}","comments_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/issues/3/comments","statuses_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/statuses/8f149e07631faec4745af25eacd1d062a8418587","head":{"label":"convoyinc:logan/sns","ref":"logan/sns","sha":"8f149e07631faec4745af25eacd1d062a8418587","user":{"login":"convoyinc","id":11140206,"avatar_url":"https://avatars.githubusercontent.com/u/11140206?v=3","gravatar_id":"","url":"https://api.github.com/users/convoyinc","html_url":"https://github.com/convoyinc","followers_url":"https://api.github.com/users/convoyinc/followers","following_url":"https://api.github.com/users/convoyinc/following{/other_user}","gists_url":"https://api.github.com/users/convoyinc/gists{/gist_id}","starred_url":"https://api.github.com/users/convoyinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/convoyinc/subscriptions","organizations_url":"https://api.github.com/users/convoyinc/orgs","repos_url":"https://api.github.com/users/convoyinc/repos","events_url":"https://api.github.com/users/convoyinc/events{/privacy}","received_events_url":"https://api.github.com/users/convoyinc/received_events","type":"Organization","site_admin":false},"repo":{"id":72069238,"name":"lib-task-scheduler","full_name":"convoyinc/lib-task-scheduler","owner":{"login":"convoyinc","id":11140206,"avatar_url":"https://avatars.githubusercontent.com/u/11140206?v=3","gravatar_id":"","url":"https://api.github.com/users/convoyinc","html_url":"https://github.com/convoyinc","followers_url":"https://api.github.com/users/convoyinc/followers","following_url":"https://api.github.com/users/convoyinc/following{/other_user}","gists_url":"https://api.github.com/users/convoyinc/gists{/gist_id}","starred_url":"https://api.github.com/users/convoyinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/convoyinc/subscriptions","organizations_url":"https://api.github.com/users/convoyinc/orgs","repos_url":"https://api.github.com/users/convoyinc/repos","events_url":"https://api.github.com/users/convoyinc/events{/privacy}","received_events_url":"https://api.github.com/users/convoyinc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/convoyinc/lib-task-scheduler","description":null,"fork":false,"url":"https://api.github.com/repos/convoyinc/lib-task-scheduler","forks_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/forks","keys_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/teams","hooks_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/hooks","issue_events_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/issues/events{/number}","events_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/events","assignees_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/assignees{/user}","branches_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/branches{/branch}","tags_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/tags","blobs_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/git/refs{/sha}","trees_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/statuses/{sha}","languages_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/languages","stargazers_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/stargazers","contributors_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/contributors","subscribers_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/subscribers","subscription_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/subscription","commits_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/commits{/sha}","git_commits_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/git/commits{/sha}","comments_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/comments{/number}","issue_comment_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/issues/comments{/number}","contents_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/contents/{+path}","compare_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/merges","archive_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/downloads","issues_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/issues{/number}","pulls_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/pulls{/number}","milestones_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/milestones{/number}","notifications_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/labels{/name}","releases_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/releases{/id}","deployments_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/deployments","created_at":"2016-10-27T03:53:57Z","updated_at":"2016-10-27T22:01:17Z","pushed_at":"2016-11-15T01:56:19Z","git_url":"git://github.com/convoyinc/lib-task-scheduler.git","ssh_url":"git@github.com:convoyinc/lib-task-scheduler.git","clone_url":"https://github.com/convoyinc/lib-task-scheduler.git","svn_url":"https://github.com/convoyinc/lib-task-scheduler","homepage":null,"size":1007,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","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":"convoyinc:master","ref":"master","sha":"04cab1cad33103caf8ba2146134bd3cdadec24e5","user":{"login":"convoyinc","id":11140206,"avatar_url":"https://avatars.githubusercontent.com/u/11140206?v=3","gravatar_id":"","url":"https://api.github.com/users/convoyinc","html_url":"https://github.com/convoyinc","followers_url":"https://api.github.com/users/convoyinc/followers","following_url":"https://api.github.com/users/convoyinc/following{/other_user}","gists_url":"https://api.github.com/users/convoyinc/gists{/gist_id}","starred_url":"https://api.github.com/users/convoyinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/convoyinc/subscriptions","organizations_url":"https://api.github.com/users/convoyinc/orgs","repos_url":"https://api.github.com/users/convoyinc/repos","events_url":"https://api.github.com/users/convoyinc/events{/privacy}","received_events_url":"https://api.github.com/users/convoyinc/received_events","type":"Organization","site_admin":false},"repo":{"id":72069238,"name":"lib-task-scheduler","full_name":"convoyinc/lib-task-scheduler","owner":{"login":"convoyinc","id":11140206,"avatar_url":"https://avatars.githubusercontent.com/u/11140206?v=3","gravatar_id":"","url":"https://api.github.com/users/convoyinc","html_url":"https://github.com/convoyinc","followers_url":"https://api.github.com/users/convoyinc/followers","following_url":"https://api.github.com/users/convoyinc/following{/other_user}","gists_url":"https://api.github.com/users/convoyinc/gists{/gist_id}","starred_url":"https://api.github.com/users/convoyinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/convoyinc/subscriptions","organizations_url":"https://api.github.com/users/convoyinc/orgs","repos_url":"https://api.github.com/users/convoyinc/repos","events_url":"https://api.github.com/users/convoyinc/events{/privacy}","received_events_url":"https://api.github.com/users/convoyinc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/convoyinc/lib-task-scheduler","description":null,"fork":false,"url":"https://api.github.com/repos/convoyinc/lib-task-scheduler","forks_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/forks","keys_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/teams","hooks_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/hooks","issue_events_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/issues/events{/number}","events_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/events","assignees_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/assignees{/user}","branches_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/branches{/branch}","tags_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/tags","blobs_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/git/refs{/sha}","trees_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/statuses/{sha}","languages_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/languages","stargazers_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/stargazers","contributors_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/contributors","subscribers_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/subscribers","subscription_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/subscription","commits_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/commits{/sha}","git_commits_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/git/commits{/sha}","comments_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/comments{/number}","issue_comment_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/issues/comments{/number}","contents_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/contents/{+path}","compare_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/merges","archive_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/downloads","issues_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/issues{/number}","pulls_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/pulls{/number}","milestones_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/milestones{/number}","notifications_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/labels{/name}","releases_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/releases{/id}","deployments_url":"https://api.github.com/repos/convoyinc/lib-task-scheduler/deployments","created_at":"2016-10-27T03:53:57Z","updated_at":"2016-10-27T22:01:17Z","pushed_at":"2016-11-15T01:56:19Z","git_url":"git://github.com/convoyinc/lib-task-scheduler.git","ssh_url":"git@github.com:convoyinc/lib-task-scheduler.git","clone_url":"https://github.com/convoyinc/lib-task-scheduler.git","svn_url":"https://github.com/convoyinc/lib-task-scheduler","homepage":null,"size":1007,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","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/convoyinc/lib-task-scheduler/pulls/3"},"html":{"href":"https://github.com/convoyinc/lib-task-scheduler/pull/3"},"issue":{"href":"https://api.github.com/repos/convoyinc/lib-task-scheduler/issues/3"},"comments":{"href":"https://api.github.com/repos/convoyinc/lib-task-scheduler/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/convoyinc/lib-task-scheduler/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/convoyinc/lib-task-scheduler/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/convoyinc/lib-task-scheduler/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/convoyinc/lib-task-scheduler/statuses/8f149e07631faec4745af25eacd1d062a8418587"}}}}
{"actor":{"display_login":"logandillard"}}