{"action":"created","comment":{"url":"https://api.github.com/repos/daveed/resque-notifier/pulls/comments/77254766","id":77254766,"diff_hunk":"@@ -1,26 +1,63 @@\n-require 'resque'\n-require 'uri'\n-require 'net/http'\n+require \"uri\"\n+require \"resque\"\n+require \"net/http\"\n+# require \"core_ext/string\"\n \n module Resque\n   module Failure\n     class Notifier < Base\n \n       def save\n-        uri     = URI(ENV['RESQUE_HOOK'])\n-        payload = { channel:    ENV['RESQUE_CHANNEL'],\n-                   username:   \"resque\",\n-                   text:       text,\n-                   icon_emoji: \":ghost:\"}.to_json\n-        Net::HTTP.post_form(uri, payload: payload)\n+        unless exception_logged_already?\n+          uri     = URI(ENV[\"RESQUE_HOOK\"])\n+          payload = {\n+            channel:    ENV[\"RESQUE_CHANNEL\"],\n+            username:   \"resque\",\n+            text:       text,\n+            icon_emoji: \":ghost:\"\n+          }.to_json\n+          Net::HTTP.post_form(uri, payload: payload)\n+        end\n+      end\n+\n+      def exception_logged_already?\n+        count = 0\n+        failed_resque_jobs.each do |failed_job|\n+          break if count > 1\n+          if failed_job.include?(error_class) && failed_job.include?(error_exception)\n+            count += 1\n+          end\n+        end\n+        count > 1 ? true : false\n+      end\n+\n+      def failed_resque_jobs\n+        Resque.redis.lrange(\"failed\", 0, 1000)\n       end\n \n       def text\n-        exception.to_s\n+        \"Worker: #{worker.to_s}      \\n\" \\","path":"lib/resque/failure/notifier.rb","position":49,"original_position":49,"commit_id":"c8a1165f25c9056c5fef3f7dcead9361a11e4b2a","original_commit_id":"c8a1165f25c9056c5fef3f7dcead9361a11e4b2a","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Redundant use of `Object#to_s` in interpolation.","created_at":"2016-09-01T21:12:18Z","updated_at":"2016-09-01T21:12:18Z","html_url":"https://github.com/daveed/resque-notifier/pull/1#discussion_r77254766","pull_request_url":"https://api.github.com/repos/daveed/resque-notifier/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/daveed/resque-notifier/pulls/comments/77254766"},"html":{"href":"https://github.com/daveed/resque-notifier/pull/1#discussion_r77254766"},"pull_request":{"href":"https://api.github.com/repos/daveed/resque-notifier/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/daveed/resque-notifier/pulls/1","id":83510128,"html_url":"https://github.com/daveed/resque-notifier/pull/1","diff_url":"https://github.com/daveed/resque-notifier/pull/1.diff","patch_url":"https://github.com/daveed/resque-notifier/pull/1.patch","issue_url":"https://api.github.com/repos/daveed/resque-notifier/issues/1","number":1,"state":"open","locked":false,"title":"display no more than one type of error","user":{"login":"mrdougwright","id":1462544,"avatar_url":"https://avatars.githubusercontent.com/u/1462544?v=3","gravatar_id":"","url":"https://api.github.com/users/mrdougwright","html_url":"https://github.com/mrdougwright","followers_url":"https://api.github.com/users/mrdougwright/followers","following_url":"https://api.github.com/users/mrdougwright/following{/other_user}","gists_url":"https://api.github.com/users/mrdougwright/gists{/gist_id}","starred_url":"https://api.github.com/users/mrdougwright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrdougwright/subscriptions","organizations_url":"https://api.github.com/users/mrdougwright/orgs","repos_url":"https://api.github.com/users/mrdougwright/repos","events_url":"https://api.github.com/users/mrdougwright/events{/privacy}","received_events_url":"https://api.github.com/users/mrdougwright/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-31T19:03:02Z","updated_at":"2016-09-01T21:12:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"50049a26a72092c6a0c9e2232d210b48877d50e9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/daveed/resque-notifier/pulls/1/commits","review_comments_url":"https://api.github.com/repos/daveed/resque-notifier/pulls/1/comments","review_comment_url":"https://api.github.com/repos/daveed/resque-notifier/pulls/comments{/number}","comments_url":"https://api.github.com/repos/daveed/resque-notifier/issues/1/comments","statuses_url":"https://api.github.com/repos/daveed/resque-notifier/statuses/c8a1165f25c9056c5fef3f7dcead9361a11e4b2a","head":{"label":"mrdougwright:exception-message","ref":"exception-message","sha":"c8a1165f25c9056c5fef3f7dcead9361a11e4b2a","user":{"login":"mrdougwright","id":1462544,"avatar_url":"https://avatars.githubusercontent.com/u/1462544?v=3","gravatar_id":"","url":"https://api.github.com/users/mrdougwright","html_url":"https://github.com/mrdougwright","followers_url":"https://api.github.com/users/mrdougwright/followers","following_url":"https://api.github.com/users/mrdougwright/following{/other_user}","gists_url":"https://api.github.com/users/mrdougwright/gists{/gist_id}","starred_url":"https://api.github.com/users/mrdougwright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrdougwright/subscriptions","organizations_url":"https://api.github.com/users/mrdougwright/orgs","repos_url":"https://api.github.com/users/mrdougwright/repos","events_url":"https://api.github.com/users/mrdougwright/events{/privacy}","received_events_url":"https://api.github.com/users/mrdougwright/received_events","type":"User","site_admin":false},"repo":{"id":67065245,"name":"resque-notifier","full_name":"mrdougwright/resque-notifier","owner":{"login":"mrdougwright","id":1462544,"avatar_url":"https://avatars.githubusercontent.com/u/1462544?v=3","gravatar_id":"","url":"https://api.github.com/users/mrdougwright","html_url":"https://github.com/mrdougwright","followers_url":"https://api.github.com/users/mrdougwright/followers","following_url":"https://api.github.com/users/mrdougwright/following{/other_user}","gists_url":"https://api.github.com/users/mrdougwright/gists{/gist_id}","starred_url":"https://api.github.com/users/mrdougwright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrdougwright/subscriptions","organizations_url":"https://api.github.com/users/mrdougwright/orgs","repos_url":"https://api.github.com/users/mrdougwright/repos","events_url":"https://api.github.com/users/mrdougwright/events{/privacy}","received_events_url":"https://api.github.com/users/mrdougwright/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mrdougwright/resque-notifier","description":"Resque Notifier is a Resque plugin that sends notifications when a job fails.","fork":true,"url":"https://api.github.com/repos/mrdougwright/resque-notifier","forks_url":"https://api.github.com/repos/mrdougwright/resque-notifier/forks","keys_url":"https://api.github.com/repos/mrdougwright/resque-notifier/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mrdougwright/resque-notifier/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mrdougwright/resque-notifier/teams","hooks_url":"https://api.github.com/repos/mrdougwright/resque-notifier/hooks","issue_events_url":"https://api.github.com/repos/mrdougwright/resque-notifier/issues/events{/number}","events_url":"https://api.github.com/repos/mrdougwright/resque-notifier/events","assignees_url":"https://api.github.com/repos/mrdougwright/resque-notifier/assignees{/user}","branches_url":"https://api.github.com/repos/mrdougwright/resque-notifier/branches{/branch}","tags_url":"https://api.github.com/repos/mrdougwright/resque-notifier/tags","blobs_url":"https://api.github.com/repos/mrdougwright/resque-notifier/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mrdougwright/resque-notifier/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mrdougwright/resque-notifier/git/refs{/sha}","trees_url":"https://api.github.com/repos/mrdougwright/resque-notifier/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mrdougwright/resque-notifier/statuses/{sha}","languages_url":"https://api.github.com/repos/mrdougwright/resque-notifier/languages","stargazers_url":"https://api.github.com/repos/mrdougwright/resque-notifier/stargazers","contributors_url":"https://api.github.com/repos/mrdougwright/resque-notifier/contributors","subscribers_url":"https://api.github.com/repos/mrdougwright/resque-notifier/subscribers","subscription_url":"https://api.github.com/repos/mrdougwright/resque-notifier/subscription","commits_url":"https://api.github.com/repos/mrdougwright/resque-notifier/commits{/sha}","git_commits_url":"https://api.github.com/repos/mrdougwright/resque-notifier/git/commits{/sha}","comments_url":"https://api.github.com/repos/mrdougwright/resque-notifier/comments{/number}","issue_comment_url":"https://api.github.com/repos/mrdougwright/resque-notifier/issues/comments{/number}","contents_url":"https://api.github.com/repos/mrdougwright/resque-notifier/contents/{+path}","compare_url":"https://api.github.com/repos/mrdougwright/resque-notifier/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mrdougwright/resque-notifier/merges","archive_url":"https://api.github.com/repos/mrdougwright/resque-notifier/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mrdougwright/resque-notifier/downloads","issues_url":"https://api.github.com/repos/mrdougwright/resque-notifier/issues{/number}","pulls_url":"https://api.github.com/repos/mrdougwright/resque-notifier/pulls{/number}","milestones_url":"https://api.github.com/repos/mrdougwright/resque-notifier/milestones{/number}","notifications_url":"https://api.github.com/repos/mrdougwright/resque-notifier/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mrdougwright/resque-notifier/labels{/name}","releases_url":"https://api.github.com/repos/mrdougwright/resque-notifier/releases{/id}","deployments_url":"https://api.github.com/repos/mrdougwright/resque-notifier/deployments","created_at":"2016-08-31T19:00:53Z","updated_at":"2016-08-31T19:00:54Z","pushed_at":"2016-09-01T21:12:15Z","git_url":"git://github.com/mrdougwright/resque-notifier.git","ssh_url":"git@github.com:mrdougwright/resque-notifier.git","clone_url":"https://github.com/mrdougwright/resque-notifier.git","svn_url":"https://github.com/mrdougwright/resque-notifier","homepage":null,"size":14,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"daveed:master","ref":"master","sha":"0222eb68492e606d2ff1de6305ec72ac2e134548","user":{"login":"daveed","id":94511,"avatar_url":"https://avatars.githubusercontent.com/u/94511?v=3","gravatar_id":"","url":"https://api.github.com/users/daveed","html_url":"https://github.com/daveed","followers_url":"https://api.github.com/users/daveed/followers","following_url":"https://api.github.com/users/daveed/following{/other_user}","gists_url":"https://api.github.com/users/daveed/gists{/gist_id}","starred_url":"https://api.github.com/users/daveed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daveed/subscriptions","organizations_url":"https://api.github.com/users/daveed/orgs","repos_url":"https://api.github.com/users/daveed/repos","events_url":"https://api.github.com/users/daveed/events{/privacy}","received_events_url":"https://api.github.com/users/daveed/received_events","type":"User","site_admin":false},"repo":{"id":66017531,"name":"resque-notifier","full_name":"daveed/resque-notifier","owner":{"login":"daveed","id":94511,"avatar_url":"https://avatars.githubusercontent.com/u/94511?v=3","gravatar_id":"","url":"https://api.github.com/users/daveed","html_url":"https://github.com/daveed","followers_url":"https://api.github.com/users/daveed/followers","following_url":"https://api.github.com/users/daveed/following{/other_user}","gists_url":"https://api.github.com/users/daveed/gists{/gist_id}","starred_url":"https://api.github.com/users/daveed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daveed/subscriptions","organizations_url":"https://api.github.com/users/daveed/orgs","repos_url":"https://api.github.com/users/daveed/repos","events_url":"https://api.github.com/users/daveed/events{/privacy}","received_events_url":"https://api.github.com/users/daveed/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/daveed/resque-notifier","description":"Resque Notifier is a Resque plugin that sends notifications when a job fails.","fork":false,"url":"https://api.github.com/repos/daveed/resque-notifier","forks_url":"https://api.github.com/repos/daveed/resque-notifier/forks","keys_url":"https://api.github.com/repos/daveed/resque-notifier/keys{/key_id}","collaborators_url":"https://api.github.com/repos/daveed/resque-notifier/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/daveed/resque-notifier/teams","hooks_url":"https://api.github.com/repos/daveed/resque-notifier/hooks","issue_events_url":"https://api.github.com/repos/daveed/resque-notifier/issues/events{/number}","events_url":"https://api.github.com/repos/daveed/resque-notifier/events","assignees_url":"https://api.github.com/repos/daveed/resque-notifier/assignees{/user}","branches_url":"https://api.github.com/repos/daveed/resque-notifier/branches{/branch}","tags_url":"https://api.github.com/repos/daveed/resque-notifier/tags","blobs_url":"https://api.github.com/repos/daveed/resque-notifier/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/daveed/resque-notifier/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/daveed/resque-notifier/git/refs{/sha}","trees_url":"https://api.github.com/repos/daveed/resque-notifier/git/trees{/sha}","statuses_url":"https://api.github.com/repos/daveed/resque-notifier/statuses/{sha}","languages_url":"https://api.github.com/repos/daveed/resque-notifier/languages","stargazers_url":"https://api.github.com/repos/daveed/resque-notifier/stargazers","contributors_url":"https://api.github.com/repos/daveed/resque-notifier/contributors","subscribers_url":"https://api.github.com/repos/daveed/resque-notifier/subscribers","subscription_url":"https://api.github.com/repos/daveed/resque-notifier/subscription","commits_url":"https://api.github.com/repos/daveed/resque-notifier/commits{/sha}","git_commits_url":"https://api.github.com/repos/daveed/resque-notifier/git/commits{/sha}","comments_url":"https://api.github.com/repos/daveed/resque-notifier/comments{/number}","issue_comment_url":"https://api.github.com/repos/daveed/resque-notifier/issues/comments{/number}","contents_url":"https://api.github.com/repos/daveed/resque-notifier/contents/{+path}","compare_url":"https://api.github.com/repos/daveed/resque-notifier/compare/{base}...{head}","merges_url":"https://api.github.com/repos/daveed/resque-notifier/merges","archive_url":"https://api.github.com/repos/daveed/resque-notifier/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/daveed/resque-notifier/downloads","issues_url":"https://api.github.com/repos/daveed/resque-notifier/issues{/number}","pulls_url":"https://api.github.com/repos/daveed/resque-notifier/pulls{/number}","milestones_url":"https://api.github.com/repos/daveed/resque-notifier/milestones{/number}","notifications_url":"https://api.github.com/repos/daveed/resque-notifier/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/daveed/resque-notifier/labels{/name}","releases_url":"https://api.github.com/repos/daveed/resque-notifier/releases{/id}","deployments_url":"https://api.github.com/repos/daveed/resque-notifier/deployments","created_at":"2016-08-18T17:32:15Z","updated_at":"2016-08-18T17:33:59Z","pushed_at":"2016-09-01T21:12:16Z","git_url":"git://github.com/daveed/resque-notifier.git","ssh_url":"git@github.com:daveed/resque-notifier.git","clone_url":"https://github.com/daveed/resque-notifier.git","svn_url":"https://github.com/daveed/resque-notifier","homepage":null,"size":13,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/daveed/resque-notifier/pulls/1"},"html":{"href":"https://github.com/daveed/resque-notifier/pull/1"},"issue":{"href":"https://api.github.com/repos/daveed/resque-notifier/issues/1"},"comments":{"href":"https://api.github.com/repos/daveed/resque-notifier/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/daveed/resque-notifier/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/daveed/resque-notifier/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/daveed/resque-notifier/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/daveed/resque-notifier/statuses/c8a1165f25c9056c5fef3f7dcead9361a11e4b2a"}}}}
{"actor":{"display_login":"houndci-bot"}}