{"action":"closed","number":1660,"pull_request":{"url":"https://api.github.com/repos/moderntribe/the-events-calendar/pulls/1660","id":150967960,"html_url":"https://github.com/moderntribe/the-events-calendar/pull/1660","diff_url":"https://github.com/moderntribe/the-events-calendar/pull/1660.diff","patch_url":"https://github.com/moderntribe/the-events-calendar/pull/1660.patch","issue_url":"https://api.github.com/repos/moderntribe/the-events-calendar/issues/1660","number":1660,"state":"closed","locked":false,"title":"Fix EA children records stuck in pending","user":{"login":"lucatume","id":2749650,"avatar_url":"https://avatars1.githubusercontent.com/u/2749650?v=4","gravatar_id":"","url":"https://api.github.com/users/lucatume","html_url":"https://github.com/lucatume","followers_url":"https://api.github.com/users/lucatume/followers","following_url":"https://api.github.com/users/lucatume/following{/other_user}","gists_url":"https://api.github.com/users/lucatume/gists{/gist_id}","starred_url":"https://api.github.com/users/lucatume/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucatume/subscriptions","organizations_url":"https://api.github.com/users/lucatume/orgs","repos_url":"https://api.github.com/users/lucatume/repos","events_url":"https://api.github.com/users/lucatume/events{/privacy}","received_events_url":"https://api.github.com/users/lucatume/received_events","type":"User","site_admin":false},"body":"Ticket: https://central.tri.be/issues/92614\r\n\r\nAlso: \r\n* https://central.tri.be/issues/91552\r\n* https://central.tri.be/issues/92297\r\n* https://central.tri.be/issues/91754\r\n\r\nRelated EA Service ticket: https://central.tri.be/issues/90501\r\n\r\nThis PR aims at fixing the issue where scheduled imports would not run unless manually triggered, before delving into the changes here is the nature of the issue:\r\n1. when the `tribe_aggregator_cron` action is triggered (or its `single` alias) the code will verify and create the children scheduled records that needs to be created\r\n2. since that children record creation involves a request to the Service, the one to create the import and get an import ID back, those request will undergo the soft HTTP limit we apply client side to avoid too many potentially time-consuming requests from going off at once\r\n3. since those imports have been rescheduled the queue meta is not set and those would not be picked up in [the logic to check for waiting records](https://github.com/moderntribe/the-events-calendar/blob/28d50f611f748c01ee335cedc9dc9496594438a7/src/Tribe/Aggregator/Record/Queue_Processor.php#L178); this would lead to the scheduled imports not running\r\n4. when 3 is fixed then, when `tribe_aggregator_process_insert_records` cron action runs, the client will try to process the queue for a number of queued scheduled imports (10 by default); usually 7 of those scheduled imports have been soft-throttled (see 2) and their corresponding import has never been created on the Service, this would make them fail; hence the message about the missing import id shown in the failure note\r\n\r\nTo cope with the above this PR puts in place the following changes:\r\na. make sure that children scheduled records always have a queue meta set; this solves 3 above\r\nb. set a flag indicating a child scheduled record needs queueing on the Service (i.e. create the import)\r\nc. when processing a record queue check that flag and, eventually, queue the import for that scheduled record; this solves 4\r\nd. when doing `c` above make sure to handle the case where the lazy import queueing itself is rescheduled (soft http request limit still applies) and handle the record rescheduling or failure\r\ne. add some checks and missing arguments on methods here and there to make sure non PHP warnings/errors/notices are generated","created_at":"2017-11-06T21:46:08Z","updated_at":"2017-11-15T16:10:52Z","closed_at":"2017-11-15T16:10:52Z","merged_at":"2017-11-15T16:10:52Z","merge_commit_sha":"92fe513e04a7ff7723a617a87a44abcf475e2b35","assignee":{"login":"lucatume","id":2749650,"avatar_url":"https://avatars1.githubusercontent.com/u/2749650?v=4","gravatar_id":"","url":"https://api.github.com/users/lucatume","html_url":"https://github.com/lucatume","followers_url":"https://api.github.com/users/lucatume/followers","following_url":"https://api.github.com/users/lucatume/following{/other_user}","gists_url":"https://api.github.com/users/lucatume/gists{/gist_id}","starred_url":"https://api.github.com/users/lucatume/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucatume/subscriptions","organizations_url":"https://api.github.com/users/lucatume/orgs","repos_url":"https://api.github.com/users/lucatume/repos","events_url":"https://api.github.com/users/lucatume/events{/privacy}","received_events_url":"https://api.github.com/users/lucatume/received_events","type":"User","site_admin":false},"assignees":[{"login":"lucatume","id":2749650,"avatar_url":"https://avatars1.githubusercontent.com/u/2749650?v=4","gravatar_id":"","url":"https://api.github.com/users/lucatume","html_url":"https://github.com/lucatume","followers_url":"https://api.github.com/users/lucatume/followers","following_url":"https://api.github.com/users/lucatume/following{/other_user}","gists_url":"https://api.github.com/users/lucatume/gists{/gist_id}","starred_url":"https://api.github.com/users/lucatume/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucatume/subscriptions","organizations_url":"https://api.github.com/users/lucatume/orgs","repos_url":"https://api.github.com/users/lucatume/repos","events_url":"https://api.github.com/users/lucatume/events{/privacy}","received_events_url":"https://api.github.com/users/lucatume/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/moderntribe/the-events-calendar/pulls/1660/commits","review_comments_url":"https://api.github.com/repos/moderntribe/the-events-calendar/pulls/1660/comments","review_comment_url":"https://api.github.com/repos/moderntribe/the-events-calendar/pulls/comments{/number}","comments_url":"https://api.github.com/repos/moderntribe/the-events-calendar/issues/1660/comments","statuses_url":"https://api.github.com/repos/moderntribe/the-events-calendar/statuses/d9b8dd45cc8549eab3f4225b8568d03a45f23695","head":{"label":"moderntribe:fix/90501-ea-scheduler-children-fix","ref":"fix/90501-ea-scheduler-children-fix","sha":"d9b8dd45cc8549eab3f4225b8568d03a45f23695","user":{"login":"moderntribe","id":2279551,"avatar_url":"https://avatars1.githubusercontent.com/u/2279551?v=4","gravatar_id":"","url":"https://api.github.com/users/moderntribe","html_url":"https://github.com/moderntribe","followers_url":"https://api.github.com/users/moderntribe/followers","following_url":"https://api.github.com/users/moderntribe/following{/other_user}","gists_url":"https://api.github.com/users/moderntribe/gists{/gist_id}","starred_url":"https://api.github.com/users/moderntribe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moderntribe/subscriptions","organizations_url":"https://api.github.com/users/moderntribe/orgs","repos_url":"https://api.github.com/users/moderntribe/repos","events_url":"https://api.github.com/users/moderntribe/events{/privacy}","received_events_url":"https://api.github.com/users/moderntribe/received_events","type":"Organization","site_admin":false},"repo":{"id":16366134,"name":"the-events-calendar","full_name":"moderntribe/the-events-calendar","owner":{"login":"moderntribe","id":2279551,"avatar_url":"https://avatars1.githubusercontent.com/u/2279551?v=4","gravatar_id":"","url":"https://api.github.com/users/moderntribe","html_url":"https://github.com/moderntribe","followers_url":"https://api.github.com/users/moderntribe/followers","following_url":"https://api.github.com/users/moderntribe/following{/other_user}","gists_url":"https://api.github.com/users/moderntribe/gists{/gist_id}","starred_url":"https://api.github.com/users/moderntribe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moderntribe/subscriptions","organizations_url":"https://api.github.com/users/moderntribe/orgs","repos_url":"https://api.github.com/users/moderntribe/repos","events_url":"https://api.github.com/users/moderntribe/events{/privacy}","received_events_url":"https://api.github.com/users/moderntribe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/moderntribe/the-events-calendar","description":"The Events Calendar WordPress plugin by Modern Tribe","fork":false,"url":"https://api.github.com/repos/moderntribe/the-events-calendar","forks_url":"https://api.github.com/repos/moderntribe/the-events-calendar/forks","keys_url":"https://api.github.com/repos/moderntribe/the-events-calendar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moderntribe/the-events-calendar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moderntribe/the-events-calendar/teams","hooks_url":"https://api.github.com/repos/moderntribe/the-events-calendar/hooks","issue_events_url":"https://api.github.com/repos/moderntribe/the-events-calendar/issues/events{/number}","events_url":"https://api.github.com/repos/moderntribe/the-events-calendar/events","assignees_url":"https://api.github.com/repos/moderntribe/the-events-calendar/assignees{/user}","branches_url":"https://api.github.com/repos/moderntribe/the-events-calendar/branches{/branch}","tags_url":"https://api.github.com/repos/moderntribe/the-events-calendar/tags","blobs_url":"https://api.github.com/repos/moderntribe/the-events-calendar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moderntribe/the-events-calendar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moderntribe/the-events-calendar/git/refs{/sha}","trees_url":"https://api.github.com/repos/moderntribe/the-events-calendar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moderntribe/the-events-calendar/statuses/{sha}","languages_url":"https://api.github.com/repos/moderntribe/the-events-calendar/languages","stargazers_url":"https://api.github.com/repos/moderntribe/the-events-calendar/stargazers","contributors_url":"https://api.github.com/repos/moderntribe/the-events-calendar/contributors","subscribers_url":"https://api.github.com/repos/moderntribe/the-events-calendar/subscribers","subscription_url":"https://api.github.com/repos/moderntribe/the-events-calendar/subscription","commits_url":"https://api.github.com/repos/moderntribe/the-events-calendar/commits{/sha}","git_commits_url":"https://api.github.com/repos/moderntribe/the-events-calendar/git/commits{/sha}","comments_url":"https://api.github.com/repos/moderntribe/the-events-calendar/comments{/number}","issue_comment_url":"https://api.github.com/repos/moderntribe/the-events-calendar/issues/comments{/number}","contents_url":"https://api.github.com/repos/moderntribe/the-events-calendar/contents/{+path}","compare_url":"https://api.github.com/repos/moderntribe/the-events-calendar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moderntribe/the-events-calendar/merges","archive_url":"https://api.github.com/repos/moderntribe/the-events-calendar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moderntribe/the-events-calendar/downloads","issues_url":"https://api.github.com/repos/moderntribe/the-events-calendar/issues{/number}","pulls_url":"https://api.github.com/repos/moderntribe/the-events-calendar/pulls{/number}","milestones_url":"https://api.github.com/repos/moderntribe/the-events-calendar/milestones{/number}","notifications_url":"https://api.github.com/repos/moderntribe/the-events-calendar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moderntribe/the-events-calendar/labels{/name}","releases_url":"https://api.github.com/repos/moderntribe/the-events-calendar/releases{/id}","deployments_url":"https://api.github.com/repos/moderntribe/the-events-calendar/deployments","created_at":"2014-01-30T02:17:01Z","updated_at":"2017-11-10T15:06:01Z","pushed_at":"2017-11-15T16:10:52Z","git_url":"git://github.com/moderntribe/the-events-calendar.git","ssh_url":"git@github.com:moderntribe/the-events-calendar.git","clone_url":"https://github.com/moderntribe/the-events-calendar.git","svn_url":"https://github.com/moderntribe/the-events-calendar","homepage":null,"size":73170,"stargazers_count":142,"watchers_count":142,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":127,"mirror_url":null,"archived":false,"open_issues_count":8,"forks":127,"open_issues":8,"watchers":142,"default_branch":"master"}},"base":{"label":"moderntribe:release/M17.22","ref":"release/M17.22","sha":"0ebf6427190d223052e602a7393545d6d2712074","user":{"login":"moderntribe","id":2279551,"avatar_url":"https://avatars1.githubusercontent.com/u/2279551?v=4","gravatar_id":"","url":"https://api.github.com/users/moderntribe","html_url":"https://github.com/moderntribe","followers_url":"https://api.github.com/users/moderntribe/followers","following_url":"https://api.github.com/users/moderntribe/following{/other_user}","gists_url":"https://api.github.com/users/moderntribe/gists{/gist_id}","starred_url":"https://api.github.com/users/moderntribe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moderntribe/subscriptions","organizations_url":"https://api.github.com/users/moderntribe/orgs","repos_url":"https://api.github.com/users/moderntribe/repos","events_url":"https://api.github.com/users/moderntribe/events{/privacy}","received_events_url":"https://api.github.com/users/moderntribe/received_events","type":"Organization","site_admin":false},"repo":{"id":16366134,"name":"the-events-calendar","full_name":"moderntribe/the-events-calendar","owner":{"login":"moderntribe","id":2279551,"avatar_url":"https://avatars1.githubusercontent.com/u/2279551?v=4","gravatar_id":"","url":"https://api.github.com/users/moderntribe","html_url":"https://github.com/moderntribe","followers_url":"https://api.github.com/users/moderntribe/followers","following_url":"https://api.github.com/users/moderntribe/following{/other_user}","gists_url":"https://api.github.com/users/moderntribe/gists{/gist_id}","starred_url":"https://api.github.com/users/moderntribe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moderntribe/subscriptions","organizations_url":"https://api.github.com/users/moderntribe/orgs","repos_url":"https://api.github.com/users/moderntribe/repos","events_url":"https://api.github.com/users/moderntribe/events{/privacy}","received_events_url":"https://api.github.com/users/moderntribe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/moderntribe/the-events-calendar","description":"The Events Calendar WordPress plugin by Modern Tribe","fork":false,"url":"https://api.github.com/repos/moderntribe/the-events-calendar","forks_url":"https://api.github.com/repos/moderntribe/the-events-calendar/forks","keys_url":"https://api.github.com/repos/moderntribe/the-events-calendar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moderntribe/the-events-calendar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moderntribe/the-events-calendar/teams","hooks_url":"https://api.github.com/repos/moderntribe/the-events-calendar/hooks","issue_events_url":"https://api.github.com/repos/moderntribe/the-events-calendar/issues/events{/number}","events_url":"https://api.github.com/repos/moderntribe/the-events-calendar/events","assignees_url":"https://api.github.com/repos/moderntribe/the-events-calendar/assignees{/user}","branches_url":"https://api.github.com/repos/moderntribe/the-events-calendar/branches{/branch}","tags_url":"https://api.github.com/repos/moderntribe/the-events-calendar/tags","blobs_url":"https://api.github.com/repos/moderntribe/the-events-calendar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moderntribe/the-events-calendar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moderntribe/the-events-calendar/git/refs{/sha}","trees_url":"https://api.github.com/repos/moderntribe/the-events-calendar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moderntribe/the-events-calendar/statuses/{sha}","languages_url":"https://api.github.com/repos/moderntribe/the-events-calendar/languages","stargazers_url":"https://api.github.com/repos/moderntribe/the-events-calendar/stargazers","contributors_url":"https://api.github.com/repos/moderntribe/the-events-calendar/contributors","subscribers_url":"https://api.github.com/repos/moderntribe/the-events-calendar/subscribers","subscription_url":"https://api.github.com/repos/moderntribe/the-events-calendar/subscription","commits_url":"https://api.github.com/repos/moderntribe/the-events-calendar/commits{/sha}","git_commits_url":"https://api.github.com/repos/moderntribe/the-events-calendar/git/commits{/sha}","comments_url":"https://api.github.com/repos/moderntribe/the-events-calendar/comments{/number}","issue_comment_url":"https://api.github.com/repos/moderntribe/the-events-calendar/issues/comments{/number}","contents_url":"https://api.github.com/repos/moderntribe/the-events-calendar/contents/{+path}","compare_url":"https://api.github.com/repos/moderntribe/the-events-calendar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moderntribe/the-events-calendar/merges","archive_url":"https://api.github.com/repos/moderntribe/the-events-calendar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moderntribe/the-events-calendar/downloads","issues_url":"https://api.github.com/repos/moderntribe/the-events-calendar/issues{/number}","pulls_url":"https://api.github.com/repos/moderntribe/the-events-calendar/pulls{/number}","milestones_url":"https://api.github.com/repos/moderntribe/the-events-calendar/milestones{/number}","notifications_url":"https://api.github.com/repos/moderntribe/the-events-calendar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moderntribe/the-events-calendar/labels{/name}","releases_url":"https://api.github.com/repos/moderntribe/the-events-calendar/releases{/id}","deployments_url":"https://api.github.com/repos/moderntribe/the-events-calendar/deployments","created_at":"2014-01-30T02:17:01Z","updated_at":"2017-11-10T15:06:01Z","pushed_at":"2017-11-15T16:10:52Z","git_url":"git://github.com/moderntribe/the-events-calendar.git","ssh_url":"git@github.com:moderntribe/the-events-calendar.git","clone_url":"https://github.com/moderntribe/the-events-calendar.git","svn_url":"https://github.com/moderntribe/the-events-calendar","homepage":null,"size":73170,"stargazers_count":142,"watchers_count":142,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":127,"mirror_url":null,"archived":false,"open_issues_count":8,"forks":127,"open_issues":8,"watchers":142,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/moderntribe/the-events-calendar/pulls/1660"},"html":{"href":"https://github.com/moderntribe/the-events-calendar/pull/1660"},"issue":{"href":"https://api.github.com/repos/moderntribe/the-events-calendar/issues/1660"},"comments":{"href":"https://api.github.com/repos/moderntribe/the-events-calendar/issues/1660/comments"},"review_comments":{"href":"https://api.github.com/repos/moderntribe/the-events-calendar/pulls/1660/comments"},"review_comment":{"href":"https://api.github.com/repos/moderntribe/the-events-calendar/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/moderntribe/the-events-calendar/pulls/1660/commits"},"statuses":{"href":"https://api.github.com/repos/moderntribe/the-events-calendar/statuses/d9b8dd45cc8549eab3f4225b8568d03a45f23695"}},"author_association":"CONTRIBUTOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"lucatume","id":2749650,"avatar_url":"https://avatars1.githubusercontent.com/u/2749650?v=4","gravatar_id":"","url":"https://api.github.com/users/lucatume","html_url":"https://github.com/lucatume","followers_url":"https://api.github.com/users/lucatume/followers","following_url":"https://api.github.com/users/lucatume/following{/other_user}","gists_url":"https://api.github.com/users/lucatume/gists{/gist_id}","starred_url":"https://api.github.com/users/lucatume/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucatume/subscriptions","organizations_url":"https://api.github.com/users/lucatume/orgs","repos_url":"https://api.github.com/users/lucatume/repos","events_url":"https://api.github.com/users/lucatume/events{/privacy}","received_events_url":"https://api.github.com/users/lucatume/received_events","type":"User","site_admin":false},"comments":5,"review_comments":0,"maintainer_can_modify":false,"commits":11,"additions":69,"deletions":9,"changed_files":5}}
{"actor":{"display_login":"lucatume"}}