{"action":"created","comment":{"url":"https://api.github.com/repos/alphasights/sneakers_handlers/pulls/comments/60712107","id":60712107,"diff_hunk":"@@ -0,0 +1,100 @@\n+require_relative \"../test_helper\"\n+require_relative \"../../lib/sneakers_handlers/exponential_backoff_handler\"\n+\n+class SneakersHandlers::ExponentialBackoffHandlerTest < Minitest::Test\n+  class FailingWorker\n+    include Sneakers::Worker\n+\n+    from_queue \"sneaker_handlers.exponential_back_test\",\n+      ack: true,\n+      durable: false,\n+      delays: [1, 3, 5],\n+      exchange: \"sneakers_handlers\",\n+      exchange_type: :topic,\n+      routing_key: \"lifecycle.created\",\n+      handler: SneakersHandlers::ExponentialBackoffHandler,\n+      arguments: {\n+        \"x-dead-letter-exchange\" => \"sneakers_handlers.error\"\n+      }\n+\n+    def work(payload)\n+      return reject!\n+    end\n+  end\n+\n+  def setup\n+    cleanup!\n+  end\n+\n+  def teardown\n+    cleanup!\n+  end\n+\n+  def test_handler_retries_with_ttl_retry_queues\n+    exchange = channel.topic(\"sneakers_handlers\", durable: false)\n+    worker = FailingWorker.new\n+\n+    worker.run\n+    exchange.publish(\"{}\", routing_key: \"lifecycle.created\")\n+\n+    sleep 0.5\n+\n+    assert_equal 1, retry_queue(1).message_count\n+\n+    sleep 0.5\n+    worker.run\n+    sleep 0.5\n+\n+    assert_equal 1, retry_queue(3).message_count\n+\n+    sleep 2.5\n+    worker.run\n+    sleep 2.5\n+\n+    assert_equal 1, retry_queue(5).message_count\n+\n+    sleep 5.0\n+    worker.run\n+    sleep 0.1\n+\n+    assert_equal 1, error_queue.message_count\n+  end","path":"test/sneaker_handlers/exponential_backoff_handler_test.rb","position":61,"original_position":61,"commit_id":"05cb8a3e6f916848f902fd671201c69a92d29bc4","original_commit_id":"05cb8a3e6f916848f902fd671201c69a92d29bc4","user":{"login":"jjbohn","id":401301,"avatar_url":"https://avatars.githubusercontent.com/u/401301?v=3","gravatar_id":"","url":"https://api.github.com/users/jjbohn","html_url":"https://github.com/jjbohn","followers_url":"https://api.github.com/users/jjbohn/followers","following_url":"https://api.github.com/users/jjbohn/following{/other_user}","gists_url":"https://api.github.com/users/jjbohn/gists{/gist_id}","starred_url":"https://api.github.com/users/jjbohn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjbohn/subscriptions","organizations_url":"https://api.github.com/users/jjbohn/orgs","repos_url":"https://api.github.com/users/jjbohn/repos","events_url":"https://api.github.com/users/jjbohn/events{/privacy}","received_events_url":"https://api.github.com/users/jjbohn/received_events","type":"User","site_admin":false},"body":"Oh, cool. Good catch. I didn't realize that kept it running. Looks way better hahah","created_at":"2016-04-22T09:20:51Z","updated_at":"2016-04-22T09:20:51Z","html_url":"https://github.com/alphasights/sneakers_handlers/pull/9#discussion_r60712107","pull_request_url":"https://api.github.com/repos/alphasights/sneakers_handlers/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/alphasights/sneakers_handlers/pulls/comments/60712107"},"html":{"href":"https://github.com/alphasights/sneakers_handlers/pull/9#discussion_r60712107"},"pull_request":{"href":"https://api.github.com/repos/alphasights/sneakers_handlers/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/alphasights/sneakers_handlers/pulls/9","id":67088125,"html_url":"https://github.com/alphasights/sneakers_handlers/pull/9","diff_url":"https://github.com/alphasights/sneakers_handlers/pull/9.diff","patch_url":"https://github.com/alphasights/sneakers_handlers/pull/9.patch","issue_url":"https://api.github.com/repos/alphasights/sneakers_handlers/issues/9","number":9,"state":"open","locked":false,"title":"[WIP] Backoff","user":{"login":"jjbohn","id":401301,"avatar_url":"https://avatars.githubusercontent.com/u/401301?v=3","gravatar_id":"","url":"https://api.github.com/users/jjbohn","html_url":"https://github.com/jjbohn","followers_url":"https://api.github.com/users/jjbohn/followers","following_url":"https://api.github.com/users/jjbohn/following{/other_user}","gists_url":"https://api.github.com/users/jjbohn/gists{/gist_id}","starred_url":"https://api.github.com/users/jjbohn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjbohn/subscriptions","organizations_url":"https://api.github.com/users/jjbohn/orgs","repos_url":"https://api.github.com/users/jjbohn/repos","events_url":"https://api.github.com/users/jjbohn/events{/privacy}","received_events_url":"https://api.github.com/users/jjbohn/received_events","type":"User","site_admin":false},"body":null,"created_at":"2016-04-19T20:54:31Z","updated_at":"2016-04-22T09:20:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dfa3059133c254bceda768b34ef8c6d276ac7fd4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alphasights/sneakers_handlers/pulls/9/commits","review_comments_url":"https://api.github.com/repos/alphasights/sneakers_handlers/pulls/9/comments","review_comment_url":"https://api.github.com/repos/alphasights/sneakers_handlers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphasights/sneakers_handlers/issues/9/comments","statuses_url":"https://api.github.com/repos/alphasights/sneakers_handlers/statuses/05cb8a3e6f916848f902fd671201c69a92d29bc4","head":{"label":"alphasights:jb-backoff","ref":"jb-backoff","sha":"05cb8a3e6f916848f902fd671201c69a92d29bc4","user":{"login":"alphasights","id":41216,"avatar_url":"https://avatars.githubusercontent.com/u/41216?v=3","gravatar_id":"","url":"https://api.github.com/users/alphasights","html_url":"https://github.com/alphasights","followers_url":"https://api.github.com/users/alphasights/followers","following_url":"https://api.github.com/users/alphasights/following{/other_user}","gists_url":"https://api.github.com/users/alphasights/gists{/gist_id}","starred_url":"https://api.github.com/users/alphasights/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphasights/subscriptions","organizations_url":"https://api.github.com/users/alphasights/orgs","repos_url":"https://api.github.com/users/alphasights/repos","events_url":"https://api.github.com/users/alphasights/events{/privacy}","received_events_url":"https://api.github.com/users/alphasights/received_events","type":"Organization","site_admin":false},"repo":{"id":54650755,"name":"sneakers_handlers","full_name":"alphasights/sneakers_handlers","owner":{"login":"alphasights","id":41216,"avatar_url":"https://avatars.githubusercontent.com/u/41216?v=3","gravatar_id":"","url":"https://api.github.com/users/alphasights","html_url":"https://github.com/alphasights","followers_url":"https://api.github.com/users/alphasights/followers","following_url":"https://api.github.com/users/alphasights/following{/other_user}","gists_url":"https://api.github.com/users/alphasights/gists{/gist_id}","starred_url":"https://api.github.com/users/alphasights/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphasights/subscriptions","organizations_url":"https://api.github.com/users/alphasights/orgs","repos_url":"https://api.github.com/users/alphasights/repos","events_url":"https://api.github.com/users/alphasights/events{/privacy}","received_events_url":"https://api.github.com/users/alphasights/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphasights/sneakers_handlers","description":"","fork":false,"url":"https://api.github.com/repos/alphasights/sneakers_handlers","forks_url":"https://api.github.com/repos/alphasights/sneakers_handlers/forks","keys_url":"https://api.github.com/repos/alphasights/sneakers_handlers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphasights/sneakers_handlers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphasights/sneakers_handlers/teams","hooks_url":"https://api.github.com/repos/alphasights/sneakers_handlers/hooks","issue_events_url":"https://api.github.com/repos/alphasights/sneakers_handlers/issues/events{/number}","events_url":"https://api.github.com/repos/alphasights/sneakers_handlers/events","assignees_url":"https://api.github.com/repos/alphasights/sneakers_handlers/assignees{/user}","branches_url":"https://api.github.com/repos/alphasights/sneakers_handlers/branches{/branch}","tags_url":"https://api.github.com/repos/alphasights/sneakers_handlers/tags","blobs_url":"https://api.github.com/repos/alphasights/sneakers_handlers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphasights/sneakers_handlers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphasights/sneakers_handlers/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphasights/sneakers_handlers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphasights/sneakers_handlers/statuses/{sha}","languages_url":"https://api.github.com/repos/alphasights/sneakers_handlers/languages","stargazers_url":"https://api.github.com/repos/alphasights/sneakers_handlers/stargazers","contributors_url":"https://api.github.com/repos/alphasights/sneakers_handlers/contributors","subscribers_url":"https://api.github.com/repos/alphasights/sneakers_handlers/subscribers","subscription_url":"https://api.github.com/repos/alphasights/sneakers_handlers/subscription","commits_url":"https://api.github.com/repos/alphasights/sneakers_handlers/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphasights/sneakers_handlers/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphasights/sneakers_handlers/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphasights/sneakers_handlers/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphasights/sneakers_handlers/contents/{+path}","compare_url":"https://api.github.com/repos/alphasights/sneakers_handlers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphasights/sneakers_handlers/merges","archive_url":"https://api.github.com/repos/alphasights/sneakers_handlers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphasights/sneakers_handlers/downloads","issues_url":"https://api.github.com/repos/alphasights/sneakers_handlers/issues{/number}","pulls_url":"https://api.github.com/repos/alphasights/sneakers_handlers/pulls{/number}","milestones_url":"https://api.github.com/repos/alphasights/sneakers_handlers/milestones{/number}","notifications_url":"https://api.github.com/repos/alphasights/sneakers_handlers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphasights/sneakers_handlers/labels{/name}","releases_url":"https://api.github.com/repos/alphasights/sneakers_handlers/releases{/id}","deployments_url":"https://api.github.com/repos/alphasights/sneakers_handlers/deployments","created_at":"2016-03-24T15:02:44Z","updated_at":"2016-03-24T15:06:33Z","pushed_at":"2016-04-21T20:35:36Z","git_url":"git://github.com/alphasights/sneakers_handlers.git","ssh_url":"git@github.com:alphasights/sneakers_handlers.git","clone_url":"https://github.com/alphasights/sneakers_handlers.git","svn_url":"https://github.com/alphasights/sneakers_handlers","homepage":null,"size":32,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"alphasights:master","ref":"master","sha":"fb8a8422063d34c4aa8140f8d63f2b148e11389a","user":{"login":"alphasights","id":41216,"avatar_url":"https://avatars.githubusercontent.com/u/41216?v=3","gravatar_id":"","url":"https://api.github.com/users/alphasights","html_url":"https://github.com/alphasights","followers_url":"https://api.github.com/users/alphasights/followers","following_url":"https://api.github.com/users/alphasights/following{/other_user}","gists_url":"https://api.github.com/users/alphasights/gists{/gist_id}","starred_url":"https://api.github.com/users/alphasights/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphasights/subscriptions","organizations_url":"https://api.github.com/users/alphasights/orgs","repos_url":"https://api.github.com/users/alphasights/repos","events_url":"https://api.github.com/users/alphasights/events{/privacy}","received_events_url":"https://api.github.com/users/alphasights/received_events","type":"Organization","site_admin":false},"repo":{"id":54650755,"name":"sneakers_handlers","full_name":"alphasights/sneakers_handlers","owner":{"login":"alphasights","id":41216,"avatar_url":"https://avatars.githubusercontent.com/u/41216?v=3","gravatar_id":"","url":"https://api.github.com/users/alphasights","html_url":"https://github.com/alphasights","followers_url":"https://api.github.com/users/alphasights/followers","following_url":"https://api.github.com/users/alphasights/following{/other_user}","gists_url":"https://api.github.com/users/alphasights/gists{/gist_id}","starred_url":"https://api.github.com/users/alphasights/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphasights/subscriptions","organizations_url":"https://api.github.com/users/alphasights/orgs","repos_url":"https://api.github.com/users/alphasights/repos","events_url":"https://api.github.com/users/alphasights/events{/privacy}","received_events_url":"https://api.github.com/users/alphasights/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphasights/sneakers_handlers","description":"","fork":false,"url":"https://api.github.com/repos/alphasights/sneakers_handlers","forks_url":"https://api.github.com/repos/alphasights/sneakers_handlers/forks","keys_url":"https://api.github.com/repos/alphasights/sneakers_handlers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphasights/sneakers_handlers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphasights/sneakers_handlers/teams","hooks_url":"https://api.github.com/repos/alphasights/sneakers_handlers/hooks","issue_events_url":"https://api.github.com/repos/alphasights/sneakers_handlers/issues/events{/number}","events_url":"https://api.github.com/repos/alphasights/sneakers_handlers/events","assignees_url":"https://api.github.com/repos/alphasights/sneakers_handlers/assignees{/user}","branches_url":"https://api.github.com/repos/alphasights/sneakers_handlers/branches{/branch}","tags_url":"https://api.github.com/repos/alphasights/sneakers_handlers/tags","blobs_url":"https://api.github.com/repos/alphasights/sneakers_handlers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphasights/sneakers_handlers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphasights/sneakers_handlers/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphasights/sneakers_handlers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphasights/sneakers_handlers/statuses/{sha}","languages_url":"https://api.github.com/repos/alphasights/sneakers_handlers/languages","stargazers_url":"https://api.github.com/repos/alphasights/sneakers_handlers/stargazers","contributors_url":"https://api.github.com/repos/alphasights/sneakers_handlers/contributors","subscribers_url":"https://api.github.com/repos/alphasights/sneakers_handlers/subscribers","subscription_url":"https://api.github.com/repos/alphasights/sneakers_handlers/subscription","commits_url":"https://api.github.com/repos/alphasights/sneakers_handlers/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphasights/sneakers_handlers/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphasights/sneakers_handlers/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphasights/sneakers_handlers/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphasights/sneakers_handlers/contents/{+path}","compare_url":"https://api.github.com/repos/alphasights/sneakers_handlers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphasights/sneakers_handlers/merges","archive_url":"https://api.github.com/repos/alphasights/sneakers_handlers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphasights/sneakers_handlers/downloads","issues_url":"https://api.github.com/repos/alphasights/sneakers_handlers/issues{/number}","pulls_url":"https://api.github.com/repos/alphasights/sneakers_handlers/pulls{/number}","milestones_url":"https://api.github.com/repos/alphasights/sneakers_handlers/milestones{/number}","notifications_url":"https://api.github.com/repos/alphasights/sneakers_handlers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphasights/sneakers_handlers/labels{/name}","releases_url":"https://api.github.com/repos/alphasights/sneakers_handlers/releases{/id}","deployments_url":"https://api.github.com/repos/alphasights/sneakers_handlers/deployments","created_at":"2016-03-24T15:02:44Z","updated_at":"2016-03-24T15:06:33Z","pushed_at":"2016-04-21T20:35:36Z","git_url":"git://github.com/alphasights/sneakers_handlers.git","ssh_url":"git@github.com:alphasights/sneakers_handlers.git","clone_url":"https://github.com/alphasights/sneakers_handlers.git","svn_url":"https://github.com/alphasights/sneakers_handlers","homepage":null,"size":32,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphasights/sneakers_handlers/pulls/9"},"html":{"href":"https://github.com/alphasights/sneakers_handlers/pull/9"},"issue":{"href":"https://api.github.com/repos/alphasights/sneakers_handlers/issues/9"},"comments":{"href":"https://api.github.com/repos/alphasights/sneakers_handlers/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/alphasights/sneakers_handlers/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/alphasights/sneakers_handlers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphasights/sneakers_handlers/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/alphasights/sneakers_handlers/statuses/05cb8a3e6f916848f902fd671201c69a92d29bc4"}}}}