{"action":"created","comment":{"url":"https://api.github.com/repos/mdsol/delayed_job_sqs/pulls/comments/86891448","pull_request_review_id":7526724,"id":86891448,"diff_hunk":"@@ -1,6 +1,38 @@\n # encoding: utf-8\n \n+require 'zlib'\n+require 'json' unless defined?(JSON)\n+require 'base64'\n+\n module DelayedJobSqs\n   module Document\n+    MAX_SQS_MESSAGE_SIZE_IN_BYTES = 2**18\n+\n+    def self.sqs_safe_json_dump(obj)\n+      json = JSON.dump(obj)\n+      if json.bytesize >= MAX_SQS_MESSAGE_SIZE_IN_BYTES\n+        JSON.dump( dj_compressed_document: compress(json) )\n+      else\n+        json\n+      end\n+    end\n+\n+    def self.sqs_safe_json_load(json)\n+      obj = JSON.load(json)\n+      if obj.is_a?(Hash) && obj.key?('dj_compressed_document')","path":"lib/delayed/serialization/sqs.rb","position":22,"original_position":22,"commit_id":"f06db7c9301de2f0f467b38e889a8d8de50b5e0c","original_commit_id":"f06db7c9301de2f0f467b38e889a8d8de50b5e0c","user":{"login":"HonoreDB","id":1795573,"avatar_url":"https://avatars.githubusercontent.com/u/1795573?v=3","gravatar_id":"","url":"https://api.github.com/users/HonoreDB","html_url":"https://github.com/HonoreDB","followers_url":"https://api.github.com/users/HonoreDB/followers","following_url":"https://api.github.com/users/HonoreDB/following{/other_user}","gists_url":"https://api.github.com/users/HonoreDB/gists{/gist_id}","starred_url":"https://api.github.com/users/HonoreDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HonoreDB/subscriptions","organizations_url":"https://api.github.com/users/HonoreDB/orgs","repos_url":"https://api.github.com/users/HonoreDB/repos","events_url":"https://api.github.com/users/HonoreDB/events{/privacy}","received_events_url":"https://api.github.com/users/HonoreDB/received_events","type":"User","site_admin":false},"body":"You mean it should blow up if it has both this key and some other one?","created_at":"2016-11-07T23:11:51Z","updated_at":"2016-11-07T23:11:51Z","html_url":"https://github.com/mdsol/delayed_job_sqs/pull/11#discussion_r86891448","pull_request_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/mdsol/delayed_job_sqs/pulls/comments/86891448"},"html":{"href":"https://github.com/mdsol/delayed_job_sqs/pull/11#discussion_r86891448"},"pull_request":{"href":"https://api.github.com/repos/mdsol/delayed_job_sqs/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/mdsol/delayed_job_sqs/pulls/11","id":92679321,"html_url":"https://github.com/mdsol/delayed_job_sqs/pull/11","diff_url":"https://github.com/mdsol/delayed_job_sqs/pull/11.diff","patch_url":"https://github.com/mdsol/delayed_job_sqs/pull/11.patch","issue_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/issues/11","number":11,"state":"open","locked":false,"title":"Compress large messages to comply with sqs's 256 byte limit","user":{"login":"HonoreDB","id":1795573,"avatar_url":"https://avatars.githubusercontent.com/u/1795573?v=3","gravatar_id":"","url":"https://api.github.com/users/HonoreDB","html_url":"https://github.com/HonoreDB","followers_url":"https://api.github.com/users/HonoreDB/followers","following_url":"https://api.github.com/users/HonoreDB/following{/other_user}","gists_url":"https://api.github.com/users/HonoreDB/gists{/gist_id}","starred_url":"https://api.github.com/users/HonoreDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HonoreDB/subscriptions","organizations_url":"https://api.github.com/users/HonoreDB/orgs","repos_url":"https://api.github.com/users/HonoreDB/repos","events_url":"https://api.github.com/users/HonoreDB/events{/privacy}","received_events_url":"https://api.github.com/users/HonoreDB/received_events","type":"User","site_admin":false},"body":"We're seeing occasional errors when we try to stuff too big of an object into our delayed jobs queue. While we're also going to try to shrink those messages, there's no reason we can't compress the payload. This detects when the payload exceeds the limit, compresses it using DEFLATE, and then Base64 encodes it for JSON-friendliness.\r\n\r\n@PoloPro @DMcKinnon-mdsol please review when convenient.","created_at":"2016-11-07T22:37:47Z","updated_at":"2016-11-07T23:11:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f88b32201551d02cb01b2f44a5740f2ec7d46355","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/pulls/11/commits","review_comments_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/pulls/11/comments","review_comment_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/issues/11/comments","statuses_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/statuses/f06db7c9301de2f0f467b38e889a8d8de50b5e0c","head":{"label":"mdsol:feature/compression","ref":"feature/compression","sha":"f06db7c9301de2f0f467b38e889a8d8de50b5e0c","user":{"login":"mdsol","id":171103,"avatar_url":"https://avatars.githubusercontent.com/u/171103?v=3","gravatar_id":"","url":"https://api.github.com/users/mdsol","html_url":"https://github.com/mdsol","followers_url":"https://api.github.com/users/mdsol/followers","following_url":"https://api.github.com/users/mdsol/following{/other_user}","gists_url":"https://api.github.com/users/mdsol/gists{/gist_id}","starred_url":"https://api.github.com/users/mdsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdsol/subscriptions","organizations_url":"https://api.github.com/users/mdsol/orgs","repos_url":"https://api.github.com/users/mdsol/repos","events_url":"https://api.github.com/users/mdsol/events{/privacy}","received_events_url":"https://api.github.com/users/mdsol/received_events","type":"Organization","site_admin":false},"repo":{"id":18423847,"name":"delayed_job_sqs","full_name":"mdsol/delayed_job_sqs","owner":{"login":"mdsol","id":171103,"avatar_url":"https://avatars.githubusercontent.com/u/171103?v=3","gravatar_id":"","url":"https://api.github.com/users/mdsol","html_url":"https://github.com/mdsol","followers_url":"https://api.github.com/users/mdsol/followers","following_url":"https://api.github.com/users/mdsol/following{/other_user}","gists_url":"https://api.github.com/users/mdsol/gists{/gist_id}","starred_url":"https://api.github.com/users/mdsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdsol/subscriptions","organizations_url":"https://api.github.com/users/mdsol/orgs","repos_url":"https://api.github.com/users/mdsol/repos","events_url":"https://api.github.com/users/mdsol/events{/privacy}","received_events_url":"https://api.github.com/users/mdsol/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mdsol/delayed_job_sqs","description":"Amazon SQS backend for delayed_job","fork":true,"url":"https://api.github.com/repos/mdsol/delayed_job_sqs","forks_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/forks","keys_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/teams","hooks_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/hooks","issue_events_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/issues/events{/number}","events_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/events","assignees_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/assignees{/user}","branches_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/branches{/branch}","tags_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/tags","blobs_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/git/refs{/sha}","trees_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/statuses/{sha}","languages_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/languages","stargazers_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/stargazers","contributors_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/contributors","subscribers_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/subscribers","subscription_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/subscription","commits_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/commits{/sha}","git_commits_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/git/commits{/sha}","comments_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/comments{/number}","issue_comment_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/issues/comments{/number}","contents_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/contents/{+path}","compare_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/merges","archive_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/downloads","issues_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/issues{/number}","pulls_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/pulls{/number}","milestones_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/milestones{/number}","notifications_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/labels{/name}","releases_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/releases{/id}","deployments_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/deployments","created_at":"2014-04-04T01:27:30Z","updated_at":"2014-04-09T15:58:21Z","pushed_at":"2016-11-07T22:37:48Z","git_url":"git://github.com/mdsol/delayed_job_sqs.git","ssh_url":"git@github.com:mdsol/delayed_job_sqs.git","clone_url":"https://github.com/mdsol/delayed_job_sqs.git","svn_url":"https://github.com/mdsol/delayed_job_sqs","homepage":"","size":611,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"mdsol:0.1-stable","ref":"0.1-stable","sha":"ecd86069aeb2213a968b53a2e9d760e815e002c8","user":{"login":"mdsol","id":171103,"avatar_url":"https://avatars.githubusercontent.com/u/171103?v=3","gravatar_id":"","url":"https://api.github.com/users/mdsol","html_url":"https://github.com/mdsol","followers_url":"https://api.github.com/users/mdsol/followers","following_url":"https://api.github.com/users/mdsol/following{/other_user}","gists_url":"https://api.github.com/users/mdsol/gists{/gist_id}","starred_url":"https://api.github.com/users/mdsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdsol/subscriptions","organizations_url":"https://api.github.com/users/mdsol/orgs","repos_url":"https://api.github.com/users/mdsol/repos","events_url":"https://api.github.com/users/mdsol/events{/privacy}","received_events_url":"https://api.github.com/users/mdsol/received_events","type":"Organization","site_admin":false},"repo":{"id":18423847,"name":"delayed_job_sqs","full_name":"mdsol/delayed_job_sqs","owner":{"login":"mdsol","id":171103,"avatar_url":"https://avatars.githubusercontent.com/u/171103?v=3","gravatar_id":"","url":"https://api.github.com/users/mdsol","html_url":"https://github.com/mdsol","followers_url":"https://api.github.com/users/mdsol/followers","following_url":"https://api.github.com/users/mdsol/following{/other_user}","gists_url":"https://api.github.com/users/mdsol/gists{/gist_id}","starred_url":"https://api.github.com/users/mdsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdsol/subscriptions","organizations_url":"https://api.github.com/users/mdsol/orgs","repos_url":"https://api.github.com/users/mdsol/repos","events_url":"https://api.github.com/users/mdsol/events{/privacy}","received_events_url":"https://api.github.com/users/mdsol/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mdsol/delayed_job_sqs","description":"Amazon SQS backend for delayed_job","fork":true,"url":"https://api.github.com/repos/mdsol/delayed_job_sqs","forks_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/forks","keys_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/teams","hooks_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/hooks","issue_events_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/issues/events{/number}","events_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/events","assignees_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/assignees{/user}","branches_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/branches{/branch}","tags_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/tags","blobs_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/git/refs{/sha}","trees_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/statuses/{sha}","languages_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/languages","stargazers_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/stargazers","contributors_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/contributors","subscribers_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/subscribers","subscription_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/subscription","commits_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/commits{/sha}","git_commits_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/git/commits{/sha}","comments_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/comments{/number}","issue_comment_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/issues/comments{/number}","contents_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/contents/{+path}","compare_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/merges","archive_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/downloads","issues_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/issues{/number}","pulls_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/pulls{/number}","milestones_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/milestones{/number}","notifications_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/labels{/name}","releases_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/releases{/id}","deployments_url":"https://api.github.com/repos/mdsol/delayed_job_sqs/deployments","created_at":"2014-04-04T01:27:30Z","updated_at":"2014-04-09T15:58:21Z","pushed_at":"2016-11-07T22:37:48Z","git_url":"git://github.com/mdsol/delayed_job_sqs.git","ssh_url":"git@github.com:mdsol/delayed_job_sqs.git","clone_url":"https://github.com/mdsol/delayed_job_sqs.git","svn_url":"https://github.com/mdsol/delayed_job_sqs","homepage":"","size":611,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mdsol/delayed_job_sqs/pulls/11"},"html":{"href":"https://github.com/mdsol/delayed_job_sqs/pull/11"},"issue":{"href":"https://api.github.com/repos/mdsol/delayed_job_sqs/issues/11"},"comments":{"href":"https://api.github.com/repos/mdsol/delayed_job_sqs/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/mdsol/delayed_job_sqs/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/mdsol/delayed_job_sqs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mdsol/delayed_job_sqs/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/mdsol/delayed_job_sqs/statuses/f06db7c9301de2f0f467b38e889a8d8de50b5e0c"}}}}
{"actor":{"display_login":"HonoreDB"}}