{"action":"opened","issue":{"url":"https://api.github.com/repos/humanmade/Cavalcade/issues/16","repository_url":"https://api.github.com/repos/humanmade/Cavalcade","labels_url":"https://api.github.com/repos/humanmade/Cavalcade/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/humanmade/Cavalcade/issues/16/comments","events_url":"https://api.github.com/repos/humanmade/Cavalcade/issues/16/events","html_url":"https://github.com/humanmade/Cavalcade/issues/16","id":150316890,"number":16,"title":"Multisite cleanup","user":{"login":"larssn","id":890725,"avatar_url":"https://avatars.githubusercontent.com/u/890725?v=3","gravatar_id":"","url":"https://api.github.com/users/larssn","html_url":"https://github.com/larssn","followers_url":"https://api.github.com/users/larssn/followers","following_url":"https://api.github.com/users/larssn/following{/other_user}","gists_url":"https://api.github.com/users/larssn/gists{/gist_id}","starred_url":"https://api.github.com/users/larssn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larssn/subscriptions","organizations_url":"https://api.github.com/users/larssn/orgs","repos_url":"https://api.github.com/users/larssn/repos","events_url":"https://api.github.com/users/larssn/events{/privacy}","received_events_url":"https://api.github.com/users/larssn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-22T09:15:40Z","updated_at":"2016-04-22T09:15:40Z","closed_at":null,"body":"Hey, so we're using a WP multisite setup, and noticed that when a site is deleted, Cavalcade doesn't clean out the jobs for these non-existent sites.\r\n\r\nExample output of wp cavalcade jobs:\r\n`| 40 | 10   | jetpack_clean_nonces                | 2016-04-20 07:50:54 | 2016-04-21 16:50:54 | waiting   |\r\n| 41 | 10   | wp_scheduled_delete                 | 2016-04-20 07:50:56 | 2016-04-22 07:50:56 | waiting   |\r\n| 42 | 10   | jp_purge_transients_cron            | 2016-04-20 07:50:56 | 2016-04-22 07:50:56 | waiting   |\r\n| 43 | 17   | jetpack_clean_nonces                | 2016-04-20 15:16:28 | 2016-04-21 16:16:28 | waiting   |\r\n| 44 | 20   | jetpack_clean_nonces                | 2016-04-20 15:29:58 | 2016-04-21 16:29:58 | waiting   |\r\n| 45 | 20   | wp_scheduled_delete                 | 2016-04-20 15:29:59 | 2016-04-22 15:29:59 | waiting   |\r\n| 46 | 20   | jp_purge_transients_cron            | 2016-04-20 15:29:59 | 2016-04-22 15:29:59 | waiting   |\r\n| 47 | 21   | jetpack_clean_nonces                | 2016-04-20 15:44:30 | 2016-04-21 16:44:30 | waiting   |\r\n| 48 | 21   | wp_scheduled_delete                 | 2016-04-20 15:44:31 | 2016-04-22 15:44:31 | waiting   |\r\n| 49 | 21   | jp_purge_transients_cron            | 2016-04-20 15:44:31 | 2016-04-22 15:44:31 | waiting   |\r\n| 50 | 1    | jetpack_sync_all_registered_options | 2016-04-20 17:42:59 | 2016-04-20 17:42:59 | completed |\r\n| 51 | 22   | jetpack_clean_nonces                | 2016-04-20 18:12:17 | 2016-04-21 09:12:17 | failed    |\r\n| 52 | 28   | jetpack_clean_nonces                | 2016-04-20 19:57:36 | 2016-04-21 16:57:36 | waiting   |\r\n| 53 | 29   | jetpack_clean_nonces                | 2016-04-21 18:04:24 | 2016-04-21 18:04:24 | waiting   |\r\n| 54 | 30   | jetpack_clean_nonces                | 2016-04-21 18:18:38 | 2016-04-21 18:18:38 | waiting   |\r\n| 55 | 31   | jetpack_clean_nonces                | 2016-04-21 18:28:13 | 2016-04-21 18:28:13 | waiting   |\r\n| 56 | 31   | wp_scheduled_delete                 | 2016-04-21 18:28:15 | 2016-04-21 18:28:15 | waiting   |\r\n| 57 | 31   | jp_purge_transients_cron            | 2016-04-21 18:28:15 | 2016-04-21 18:28:15 | waiting   |\r\n| 58 | 34   | jetpack_clean_nonces                | 2016-04-21 19:09:27 | 2016-04-21 19:09:27 | waiting   |\r\n| 59 | 34   | wp_scheduled_delete                 | 2016-04-21 19:09:28 | 2016-04-21 19:09:28 | waiting   |\r\n| 60 | 34   | jp_purge_transients_cron            | 2016-04-21 19:09:28 | 2016-04-21 19:09:28 | waiting   |`\r\n\r\n`add_action('delete_blog', 'cleanup')\r\n\r\nfunction cleanup($site_id) {\r\n// remove jobs owned by $site_id\r\n}`\r\n\r\nI can fix it, if you want."}}