{"action":"created","comment":{"url":"https://api.github.com/repos/SCPR/SCPRv4/pulls/comments/229870252","pull_request_review_id":170475379,"id":229870252,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyOTg3MDI1Mg==","diff_hunk":"@@ -22,19 +22,14 @@ def update_podcast_episode file\n       if podcast_episode_record.present? && episode.audio.length === 0\n         podcast_id = podcast_episode_record[\"podcastId\"]\n         episode_id = podcast_episode_record[\"id\"]\n-\n-        backgroundAudioFileUrl = File.join(Rails.configuration.x.scpr.audio_url, relative_dir, filename)\n-\n-        begin\n-          $megaphone\n-            .podcast(podcast_id)\n-            .episode(episode_id)\n-            .update({\n-              backgroundAudioFileUrl: backgroundAudioFileUrl\n-            })\n-        rescue\n-          {}\n-        end\n+        background_audio_file_url = File.join(Rails.configuration.x.scpr.audio_url, relative_dir, filename)\n+\n+        # Enqueue the UpdatePodcastAudio Job 2 seconds from now to give some buffer between processing and uploading\n+        Resque.enqueue_at(2.seconds.from_now, Job::UpdateMegaphoneAudio, {","path":"app/uploaders/audio_uploader.rb","position":20,"original_position":20,"commit_id":"85d7f573d3d138e1711a640ce0e7bb629f9721cc","original_commit_id":"85d7f573d3d138e1711a640ce0e7bb629f9721cc","user":{"login":"nakedsushi","id":360040,"node_id":"MDQ6VXNlcjM2MDA0MA==","avatar_url":"https://avatars0.githubusercontent.com/u/360040?v=4","gravatar_id":"","url":"https://api.github.com/users/nakedsushi","html_url":"https://github.com/nakedsushi","followers_url":"https://api.github.com/users/nakedsushi/followers","following_url":"https://api.github.com/users/nakedsushi/following{/other_user}","gists_url":"https://api.github.com/users/nakedsushi/gists{/gist_id}","starred_url":"https://api.github.com/users/nakedsushi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nakedsushi/subscriptions","organizations_url":"https://api.github.com/users/nakedsushi/orgs","repos_url":"https://api.github.com/users/nakedsushi/repos","events_url":"https://api.github.com/users/nakedsushi/events{/privacy}","received_events_url":"https://api.github.com/users/nakedsushi/received_events","type":"User","site_admin":false},"body":"Similar, but `Resque.enqueue_in(2.seconds, Job::...)` might be easier to read","created_at":"2018-10-31T21:14:07Z","updated_at":"2018-10-31T21:14:22Z","html_url":"https://github.com/SCPR/SCPRv4/pull/1333#discussion_r229870252","pull_request_url":"https://api.github.com/repos/SCPR/SCPRv4/pulls/1333","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/SCPR/SCPRv4/pulls/comments/229870252"},"html":{"href":"https://github.com/SCPR/SCPRv4/pull/1333#discussion_r229870252"},"pull_request":{"href":"https://api.github.com/repos/SCPR/SCPRv4/pulls/1333"}}},"pull_request":{"url":"https://api.github.com/repos/SCPR/SCPRv4/pulls/1333","id":227073836,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3MDczODM2","html_url":"https://github.com/SCPR/SCPRv4/pull/1333","diff_url":"https://github.com/SCPR/SCPRv4/pull/1333.diff","patch_url":"https://github.com/SCPR/SCPRv4/pull/1333.patch","issue_url":"https://api.github.com/repos/SCPR/SCPRv4/issues/1333","number":1333,"state":"open","locked":false,"title":"Fixes timing issue when sharing a url with Megaphone's API","user":{"login":"arellaTV","id":16679701,"node_id":"MDQ6VXNlcjE2Njc5NzAx","avatar_url":"https://avatars3.githubusercontent.com/u/16679701?v=4","gravatar_id":"","url":"https://api.github.com/users/arellaTV","html_url":"https://github.com/arellaTV","followers_url":"https://api.github.com/users/arellaTV/followers","following_url":"https://api.github.com/users/arellaTV/following{/other_user}","gists_url":"https://api.github.com/users/arellaTV/gists{/gist_id}","starred_url":"https://api.github.com/users/arellaTV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arellaTV/subscriptions","organizations_url":"https://api.github.com/users/arellaTV/orgs","repos_url":"https://api.github.com/users/arellaTV/repos","events_url":"https://api.github.com/users/arellaTV/events{/privacy}","received_events_url":"https://api.github.com/users/arellaTV/received_events","type":"User","site_admin":false},"body":"## Bug\r\nThe resulting file in Megaphone is usually ~1.5x larger than the original file.\r\n\r\n\r\n## Explanation\r\nOutpost shares the audio url immediately, even if the file itself hasn't finished processing. You can read more about that in this section: https://github.com/SCPR/SCPRv4/blob/0d976b3c003b285f65104f0300a262b35e0fb60c/app/models/audio.rb#L299-L317\r\n\r\nI thought I had covered this behavior by adding the following to the `AudioUploader` module (which essentially performs a PUT request after an audio file is stored):\r\nhttps://github.com/SCPR/SCPRv4/blob/0d976b3c003b285f65104f0300a262b35e0fb60c/app/uploaders/audio_uploader.rb#L11-L40\r\n\r\nBut when I wrote this, I hadn't considered that even files manually uploaded would still use the url prematurely because it doesn't take into account whether the new audio was recently uploaded or an external url (i.e. resound url):\r\nhttps://github.com/SCPR/SCPRv4/blob/0d976b3c003b285f65104f0300a262b35e0fb60c/app/models/show_episode.rb#L353-L355\r\n\r\n## Proposed Solution\r\n- If the file is coming from our media server, don't perform a PUT request - instead, let the AudioUploader after store callback handle that.\r\n- Add a 2 second delay before performing the PUT request to give some additional padding\r\n","created_at":"2018-10-30T20:40:33Z","updated_at":"2018-10-31T21:14:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1fb865ad8a4ea5ce882500fd278818d9783dad42","assignee":{"login":"arellaTV","id":16679701,"node_id":"MDQ6VXNlcjE2Njc5NzAx","avatar_url":"https://avatars3.githubusercontent.com/u/16679701?v=4","gravatar_id":"","url":"https://api.github.com/users/arellaTV","html_url":"https://github.com/arellaTV","followers_url":"https://api.github.com/users/arellaTV/followers","following_url":"https://api.github.com/users/arellaTV/following{/other_user}","gists_url":"https://api.github.com/users/arellaTV/gists{/gist_id}","starred_url":"https://api.github.com/users/arellaTV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arellaTV/subscriptions","organizations_url":"https://api.github.com/users/arellaTV/orgs","repos_url":"https://api.github.com/users/arellaTV/repos","events_url":"https://api.github.com/users/arellaTV/events{/privacy}","received_events_url":"https://api.github.com/users/arellaTV/received_events","type":"User","site_admin":false},"assignees":[{"login":"arellaTV","id":16679701,"node_id":"MDQ6VXNlcjE2Njc5NzAx","avatar_url":"https://avatars3.githubusercontent.com/u/16679701?v=4","gravatar_id":"","url":"https://api.github.com/users/arellaTV","html_url":"https://github.com/arellaTV","followers_url":"https://api.github.com/users/arellaTV/followers","following_url":"https://api.github.com/users/arellaTV/following{/other_user}","gists_url":"https://api.github.com/users/arellaTV/gists{/gist_id}","starred_url":"https://api.github.com/users/arellaTV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arellaTV/subscriptions","organizations_url":"https://api.github.com/users/arellaTV/orgs","repos_url":"https://api.github.com/users/arellaTV/repos","events_url":"https://api.github.com/users/arellaTV/events{/privacy}","received_events_url":"https://api.github.com/users/arellaTV/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"jo-im","id":16568530,"node_id":"MDQ6VXNlcjE2NTY4NTMw","avatar_url":"https://avatars2.githubusercontent.com/u/16568530?v=4","gravatar_id":"","url":"https://api.github.com/users/jo-im","html_url":"https://github.com/jo-im","followers_url":"https://api.github.com/users/jo-im/followers","following_url":"https://api.github.com/users/jo-im/following{/other_user}","gists_url":"https://api.github.com/users/jo-im/gists{/gist_id}","starred_url":"https://api.github.com/users/jo-im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jo-im/subscriptions","organizations_url":"https://api.github.com/users/jo-im/orgs","repos_url":"https://api.github.com/users/jo-im/repos","events_url":"https://api.github.com/users/jo-im/events{/privacy}","received_events_url":"https://api.github.com/users/jo-im/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":208451097,"node_id":"MDU6TGFiZWwyMDg0NTEwOTc=","url":"https://api.github.com/repos/SCPR/SCPRv4/labels/bug","name":"bug","color":"e11d21","default":true}],"milestone":null,"commits_url":"https://api.github.com/repos/SCPR/SCPRv4/pulls/1333/commits","review_comments_url":"https://api.github.com/repos/SCPR/SCPRv4/pulls/1333/comments","review_comment_url":"https://api.github.com/repos/SCPR/SCPRv4/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SCPR/SCPRv4/issues/1333/comments","statuses_url":"https://api.github.com/repos/SCPR/SCPRv4/statuses/85d7f573d3d138e1711a640ce0e7bb629f9721cc","head":{"label":"SCPR:fix-megaphone","ref":"fix-megaphone","sha":"85d7f573d3d138e1711a640ce0e7bb629f9721cc","user":{"login":"SCPR","id":855010,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1NTAxMA==","avatar_url":"https://avatars1.githubusercontent.com/u/855010?v=4","gravatar_id":"","url":"https://api.github.com/users/SCPR","html_url":"https://github.com/SCPR","followers_url":"https://api.github.com/users/SCPR/followers","following_url":"https://api.github.com/users/SCPR/following{/other_user}","gists_url":"https://api.github.com/users/SCPR/gists{/gist_id}","starred_url":"https://api.github.com/users/SCPR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SCPR/subscriptions","organizations_url":"https://api.github.com/users/SCPR/orgs","repos_url":"https://api.github.com/users/SCPR/repos","events_url":"https://api.github.com/users/SCPR/events{/privacy}","received_events_url":"https://api.github.com/users/SCPR/received_events","type":"Organization","site_admin":false},"repo":{"id":2558636,"node_id":"MDEwOlJlcG9zaXRvcnkyNTU4NjM2","name":"SCPRv4","full_name":"SCPR/SCPRv4","private":false,"owner":{"login":"SCPR","id":855010,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1NTAxMA==","avatar_url":"https://avatars1.githubusercontent.com/u/855010?v=4","gravatar_id":"","url":"https://api.github.com/users/SCPR","html_url":"https://github.com/SCPR","followers_url":"https://api.github.com/users/SCPR/followers","following_url":"https://api.github.com/users/SCPR/following{/other_user}","gists_url":"https://api.github.com/users/SCPR/gists{/gist_id}","starred_url":"https://api.github.com/users/SCPR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SCPR/subscriptions","organizations_url":"https://api.github.com/users/SCPR/orgs","repos_url":"https://api.github.com/users/SCPR/repos","events_url":"https://api.github.com/users/SCPR/events{/privacy}","received_events_url":"https://api.github.com/users/SCPR/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/SCPR/SCPRv4","description":"KPCC on Rails","fork":false,"url":"https://api.github.com/repos/SCPR/SCPRv4","forks_url":"https://api.github.com/repos/SCPR/SCPRv4/forks","keys_url":"https://api.github.com/repos/SCPR/SCPRv4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SCPR/SCPRv4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SCPR/SCPRv4/teams","hooks_url":"https://api.github.com/repos/SCPR/SCPRv4/hooks","issue_events_url":"https://api.github.com/repos/SCPR/SCPRv4/issues/events{/number}","events_url":"https://api.github.com/repos/SCPR/SCPRv4/events","assignees_url":"https://api.github.com/repos/SCPR/SCPRv4/assignees{/user}","branches_url":"https://api.github.com/repos/SCPR/SCPRv4/branches{/branch}","tags_url":"https://api.github.com/repos/SCPR/SCPRv4/tags","blobs_url":"https://api.github.com/repos/SCPR/SCPRv4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SCPR/SCPRv4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SCPR/SCPRv4/git/refs{/sha}","trees_url":"https://api.github.com/repos/SCPR/SCPRv4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SCPR/SCPRv4/statuses/{sha}","languages_url":"https://api.github.com/repos/SCPR/SCPRv4/languages","stargazers_url":"https://api.github.com/repos/SCPR/SCPRv4/stargazers","contributors_url":"https://api.github.com/repos/SCPR/SCPRv4/contributors","subscribers_url":"https://api.github.com/repos/SCPR/SCPRv4/subscribers","subscription_url":"https://api.github.com/repos/SCPR/SCPRv4/subscription","commits_url":"https://api.github.com/repos/SCPR/SCPRv4/commits{/sha}","git_commits_url":"https://api.github.com/repos/SCPR/SCPRv4/git/commits{/sha}","comments_url":"https://api.github.com/repos/SCPR/SCPRv4/comments{/number}","issue_comment_url":"https://api.github.com/repos/SCPR/SCPRv4/issues/comments{/number}","contents_url":"https://api.github.com/repos/SCPR/SCPRv4/contents/{+path}","compare_url":"https://api.github.com/repos/SCPR/SCPRv4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SCPR/SCPRv4/merges","archive_url":"https://api.github.com/repos/SCPR/SCPRv4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SCPR/SCPRv4/downloads","issues_url":"https://api.github.com/repos/SCPR/SCPRv4/issues{/number}","pulls_url":"https://api.github.com/repos/SCPR/SCPRv4/pulls{/number}","milestones_url":"https://api.github.com/repos/SCPR/SCPRv4/milestones{/number}","notifications_url":"https://api.github.com/repos/SCPR/SCPRv4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SCPR/SCPRv4/labels{/name}","releases_url":"https://api.github.com/repos/SCPR/SCPRv4/releases{/id}","deployments_url":"https://api.github.com/repos/SCPR/SCPRv4/deployments","created_at":"2011-10-11T22:05:04Z","updated_at":"2018-10-25T23:39:25Z","pushed_at":"2018-10-31T20:45:48Z","git_url":"git://github.com/SCPR/SCPRv4.git","ssh_url":"git@github.com:SCPR/SCPRv4.git","clone_url":"https://github.com/SCPR/SCPRv4.git","svn_url":"https://github.com/SCPR/SCPRv4","homepage":"http://www.scpr.org","size":72816,"stargazers_count":15,"watchers_count":15,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":91,"license":null,"forks":8,"open_issues":91,"watchers":15,"default_branch":"master"}},"base":{"label":"SCPR:master","ref":"master","sha":"0d976b3c003b285f65104f0300a262b35e0fb60c","user":{"login":"SCPR","id":855010,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1NTAxMA==","avatar_url":"https://avatars1.githubusercontent.com/u/855010?v=4","gravatar_id":"","url":"https://api.github.com/users/SCPR","html_url":"https://github.com/SCPR","followers_url":"https://api.github.com/users/SCPR/followers","following_url":"https://api.github.com/users/SCPR/following{/other_user}","gists_url":"https://api.github.com/users/SCPR/gists{/gist_id}","starred_url":"https://api.github.com/users/SCPR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SCPR/subscriptions","organizations_url":"https://api.github.com/users/SCPR/orgs","repos_url":"https://api.github.com/users/SCPR/repos","events_url":"https://api.github.com/users/SCPR/events{/privacy}","received_events_url":"https://api.github.com/users/SCPR/received_events","type":"Organization","site_admin":false},"repo":{"id":2558636,"node_id":"MDEwOlJlcG9zaXRvcnkyNTU4NjM2","name":"SCPRv4","full_name":"SCPR/SCPRv4","private":false,"owner":{"login":"SCPR","id":855010,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1NTAxMA==","avatar_url":"https://avatars1.githubusercontent.com/u/855010?v=4","gravatar_id":"","url":"https://api.github.com/users/SCPR","html_url":"https://github.com/SCPR","followers_url":"https://api.github.com/users/SCPR/followers","following_url":"https://api.github.com/users/SCPR/following{/other_user}","gists_url":"https://api.github.com/users/SCPR/gists{/gist_id}","starred_url":"https://api.github.com/users/SCPR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SCPR/subscriptions","organizations_url":"https://api.github.com/users/SCPR/orgs","repos_url":"https://api.github.com/users/SCPR/repos","events_url":"https://api.github.com/users/SCPR/events{/privacy}","received_events_url":"https://api.github.com/users/SCPR/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/SCPR/SCPRv4","description":"KPCC on Rails","fork":false,"url":"https://api.github.com/repos/SCPR/SCPRv4","forks_url":"https://api.github.com/repos/SCPR/SCPRv4/forks","keys_url":"https://api.github.com/repos/SCPR/SCPRv4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SCPR/SCPRv4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SCPR/SCPRv4/teams","hooks_url":"https://api.github.com/repos/SCPR/SCPRv4/hooks","issue_events_url":"https://api.github.com/repos/SCPR/SCPRv4/issues/events{/number}","events_url":"https://api.github.com/repos/SCPR/SCPRv4/events","assignees_url":"https://api.github.com/repos/SCPR/SCPRv4/assignees{/user}","branches_url":"https://api.github.com/repos/SCPR/SCPRv4/branches{/branch}","tags_url":"https://api.github.com/repos/SCPR/SCPRv4/tags","blobs_url":"https://api.github.com/repos/SCPR/SCPRv4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SCPR/SCPRv4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SCPR/SCPRv4/git/refs{/sha}","trees_url":"https://api.github.com/repos/SCPR/SCPRv4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SCPR/SCPRv4/statuses/{sha}","languages_url":"https://api.github.com/repos/SCPR/SCPRv4/languages","stargazers_url":"https://api.github.com/repos/SCPR/SCPRv4/stargazers","contributors_url":"https://api.github.com/repos/SCPR/SCPRv4/contributors","subscribers_url":"https://api.github.com/repos/SCPR/SCPRv4/subscribers","subscription_url":"https://api.github.com/repos/SCPR/SCPRv4/subscription","commits_url":"https://api.github.com/repos/SCPR/SCPRv4/commits{/sha}","git_commits_url":"https://api.github.com/repos/SCPR/SCPRv4/git/commits{/sha}","comments_url":"https://api.github.com/repos/SCPR/SCPRv4/comments{/number}","issue_comment_url":"https://api.github.com/repos/SCPR/SCPRv4/issues/comments{/number}","contents_url":"https://api.github.com/repos/SCPR/SCPRv4/contents/{+path}","compare_url":"https://api.github.com/repos/SCPR/SCPRv4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SCPR/SCPRv4/merges","archive_url":"https://api.github.com/repos/SCPR/SCPRv4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SCPR/SCPRv4/downloads","issues_url":"https://api.github.com/repos/SCPR/SCPRv4/issues{/number}","pulls_url":"https://api.github.com/repos/SCPR/SCPRv4/pulls{/number}","milestones_url":"https://api.github.com/repos/SCPR/SCPRv4/milestones{/number}","notifications_url":"https://api.github.com/repos/SCPR/SCPRv4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SCPR/SCPRv4/labels{/name}","releases_url":"https://api.github.com/repos/SCPR/SCPRv4/releases{/id}","deployments_url":"https://api.github.com/repos/SCPR/SCPRv4/deployments","created_at":"2011-10-11T22:05:04Z","updated_at":"2018-10-25T23:39:25Z","pushed_at":"2018-10-31T20:45:48Z","git_url":"git://github.com/SCPR/SCPRv4.git","ssh_url":"git@github.com:SCPR/SCPRv4.git","clone_url":"https://github.com/SCPR/SCPRv4.git","svn_url":"https://github.com/SCPR/SCPRv4","homepage":"http://www.scpr.org","size":72816,"stargazers_count":15,"watchers_count":15,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":91,"license":null,"forks":8,"open_issues":91,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SCPR/SCPRv4/pulls/1333"},"html":{"href":"https://github.com/SCPR/SCPRv4/pull/1333"},"issue":{"href":"https://api.github.com/repos/SCPR/SCPRv4/issues/1333"},"comments":{"href":"https://api.github.com/repos/SCPR/SCPRv4/issues/1333/comments"},"review_comments":{"href":"https://api.github.com/repos/SCPR/SCPRv4/pulls/1333/comments"},"review_comment":{"href":"https://api.github.com/repos/SCPR/SCPRv4/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SCPR/SCPRv4/pulls/1333/commits"},"statuses":{"href":"https://api.github.com/repos/SCPR/SCPRv4/statuses/85d7f573d3d138e1711a640ce0e7bb629f9721cc"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"nakedsushi"}}