{"action":"closed","number":359,"pull_request":{"url":"https://api.github.com/repos/novoda/download-manager/pulls/359","id":173720374,"html_url":"https://github.com/novoda/download-manager/pull/359","diff_url":"https://github.com/novoda/download-manager/pull/359.diff","patch_url":"https://github.com/novoda/download-manager/pull/359.patch","issue_url":"https://api.github.com/repos/novoda/download-manager/issues/359","number":359,"state":"closed","locked":false,"title":"Migration Fixes","user":{"login":"Mecharyry","id":3380092,"avatar_url":"https://avatars1.githubusercontent.com/u/3380092?v=4","gravatar_id":"","url":"https://api.github.com/users/Mecharyry","html_url":"https://github.com/Mecharyry","followers_url":"https://api.github.com/users/Mecharyry/followers","following_url":"https://api.github.com/users/Mecharyry/following{/other_user}","gists_url":"https://api.github.com/users/Mecharyry/gists{/gist_id}","starred_url":"https://api.github.com/users/Mecharyry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mecharyry/subscriptions","organizations_url":"https://api.github.com/users/Mecharyry/orgs","repos_url":"https://api.github.com/users/Mecharyry/repos","events_url":"https://api.github.com/users/Mecharyry/events{/privacy}","received_events_url":"https://api.github.com/users/Mecharyry/received_events","type":"User","site_admin":false},"body":"## Problem\r\nThis PR fixes a few problems with the `MigrationJob`:\r\n\r\n- A client application needs to be able to specify the `DownloadBatchId` from version one 😬 otherwise it is unable to locate some additional data that is required to work with a download.\r\n- The `MigrationJob` completes too quickly and relies on mutation of a `MigrationStatus`. If the `Migration` occurs too fast, given that we are reporting back to the `main-thread` using a `Handler` we could be potentially emitting the same status multiple times. It's mutated before the handler posts to the `main-thread`, modifying an already existing reference 😬 \r\n- The `MigrationJob` uses the `hashcode` of the entire `MigrationStatus` object when posting notifications 😬 so it will recreate notifications each and every time / may not remove persistent notifications etc because they all rely on the notification ids being the same! \r\n- Partial migrations were never taken into account when updating the migration percentage 😬 \r\n\r\n## Solution\r\n\r\n- For now we are using the `notificationExtras` from the first `file` retrieved from the `Downloads` table in v1 for the `DownloadBatchId`. We will need to provide a different mechanism for specifying the mapping before we release this library publicly. \r\n- It's ok to mutate the `MigrationStatus` anywhere we have control of it **BUT** before we give control of it over to clients we should create an `ImmutableCopy`.\r\n- Use the `hashcode` of the migration job identifier as the notification id. So all notifications from a given `MigrationJob` share the same notification. \r\n- Ensure that the `total` and `current` completed migrations and the associated migration percentage is driven by both the partial and complete migrations. \r\n\r\n## Screen Capture\r\n![migration mp4](https://user-images.githubusercontent.com/3380092/37150664-6d600d8a-22ca-11e8-8d6a-8e9b51229563.gif)\r\n\r\n","created_at":"2018-03-08T12:12:57Z","updated_at":"2018-03-08T15:12:42Z","closed_at":"2018-03-08T15:12:42Z","merged_at":"2018-03-08T15:12:42Z","merge_commit_sha":"9409f9d9a9d9dbbdef5431c740e517fb1c400f70","assignee":{"login":"zegnus","id":2845931,"avatar_url":"https://avatars3.githubusercontent.com/u/2845931?v=4","gravatar_id":"","url":"https://api.github.com/users/zegnus","html_url":"https://github.com/zegnus","followers_url":"https://api.github.com/users/zegnus/followers","following_url":"https://api.github.com/users/zegnus/following{/other_user}","gists_url":"https://api.github.com/users/zegnus/gists{/gist_id}","starred_url":"https://api.github.com/users/zegnus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zegnus/subscriptions","organizations_url":"https://api.github.com/users/zegnus/orgs","repos_url":"https://api.github.com/users/zegnus/repos","events_url":"https://api.github.com/users/zegnus/events{/privacy}","received_events_url":"https://api.github.com/users/zegnus/received_events","type":"User","site_admin":false},"assignees":[{"login":"zegnus","id":2845931,"avatar_url":"https://avatars3.githubusercontent.com/u/2845931?v=4","gravatar_id":"","url":"https://api.github.com/users/zegnus","html_url":"https://github.com/zegnus","followers_url":"https://api.github.com/users/zegnus/followers","following_url":"https://api.github.com/users/zegnus/following{/other_user}","gists_url":"https://api.github.com/users/zegnus/gists{/gist_id}","starred_url":"https://api.github.com/users/zegnus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zegnus/subscriptions","organizations_url":"https://api.github.com/users/zegnus/orgs","repos_url":"https://api.github.com/users/zegnus/repos","events_url":"https://api.github.com/users/zegnus/events{/privacy}","received_events_url":"https://api.github.com/users/zegnus/received_events","type":"User","site_admin":false},{"login":"danybony","id":3942812,"avatar_url":"https://avatars3.githubusercontent.com/u/3942812?v=4","gravatar_id":"","url":"https://api.github.com/users/danybony","html_url":"https://github.com/danybony","followers_url":"https://api.github.com/users/danybony/followers","following_url":"https://api.github.com/users/danybony/following{/other_user}","gists_url":"https://api.github.com/users/danybony/gists{/gist_id}","starred_url":"https://api.github.com/users/danybony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danybony/subscriptions","organizations_url":"https://api.github.com/users/danybony/orgs","repos_url":"https://api.github.com/users/danybony/repos","events_url":"https://api.github.com/users/danybony/events{/privacy}","received_events_url":"https://api.github.com/users/danybony/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":576993037,"url":"https://api.github.com/repos/novoda/download-manager/labels/v2","name":"v2","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/novoda/download-manager/pulls/359/commits","review_comments_url":"https://api.github.com/repos/novoda/download-manager/pulls/359/comments","review_comment_url":"https://api.github.com/repos/novoda/download-manager/pulls/comments{/number}","comments_url":"https://api.github.com/repos/novoda/download-manager/issues/359/comments","statuses_url":"https://api.github.com/repos/novoda/download-manager/statuses/c651c1edaa20922455948485416e9c9175cab41f","head":{"label":"novoda:partial_migration_file_size","ref":"partial_migration_file_size","sha":"c651c1edaa20922455948485416e9c9175cab41f","user":{"login":"novoda","id":74874,"avatar_url":"https://avatars2.githubusercontent.com/u/74874?v=4","gravatar_id":"","url":"https://api.github.com/users/novoda","html_url":"https://github.com/novoda","followers_url":"https://api.github.com/users/novoda/followers","following_url":"https://api.github.com/users/novoda/following{/other_user}","gists_url":"https://api.github.com/users/novoda/gists{/gist_id}","starred_url":"https://api.github.com/users/novoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novoda/subscriptions","organizations_url":"https://api.github.com/users/novoda/orgs","repos_url":"https://api.github.com/users/novoda/repos","events_url":"https://api.github.com/users/novoda/events{/privacy}","received_events_url":"https://api.github.com/users/novoda/received_events","type":"Organization","site_admin":false},"repo":{"id":35211795,"name":"download-manager","full_name":"novoda/download-manager","owner":{"login":"novoda","id":74874,"avatar_url":"https://avatars2.githubusercontent.com/u/74874?v=4","gravatar_id":"","url":"https://api.github.com/users/novoda","html_url":"https://github.com/novoda","followers_url":"https://api.github.com/users/novoda/followers","following_url":"https://api.github.com/users/novoda/following{/other_user}","gists_url":"https://api.github.com/users/novoda/gists{/gist_id}","starred_url":"https://api.github.com/users/novoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novoda/subscriptions","organizations_url":"https://api.github.com/users/novoda/orgs","repos_url":"https://api.github.com/users/novoda/repos","events_url":"https://api.github.com/users/novoda/events{/privacy}","received_events_url":"https://api.github.com/users/novoda/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/novoda/download-manager","description":"Download manager based on AOSP DM but allowing downloading to internal private storage","fork":false,"url":"https://api.github.com/repos/novoda/download-manager","forks_url":"https://api.github.com/repos/novoda/download-manager/forks","keys_url":"https://api.github.com/repos/novoda/download-manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/novoda/download-manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/novoda/download-manager/teams","hooks_url":"https://api.github.com/repos/novoda/download-manager/hooks","issue_events_url":"https://api.github.com/repos/novoda/download-manager/issues/events{/number}","events_url":"https://api.github.com/repos/novoda/download-manager/events","assignees_url":"https://api.github.com/repos/novoda/download-manager/assignees{/user}","branches_url":"https://api.github.com/repos/novoda/download-manager/branches{/branch}","tags_url":"https://api.github.com/repos/novoda/download-manager/tags","blobs_url":"https://api.github.com/repos/novoda/download-manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/novoda/download-manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/novoda/download-manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/novoda/download-manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/novoda/download-manager/statuses/{sha}","languages_url":"https://api.github.com/repos/novoda/download-manager/languages","stargazers_url":"https://api.github.com/repos/novoda/download-manager/stargazers","contributors_url":"https://api.github.com/repos/novoda/download-manager/contributors","subscribers_url":"https://api.github.com/repos/novoda/download-manager/subscribers","subscription_url":"https://api.github.com/repos/novoda/download-manager/subscription","commits_url":"https://api.github.com/repos/novoda/download-manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/novoda/download-manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/novoda/download-manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/novoda/download-manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/novoda/download-manager/contents/{+path}","compare_url":"https://api.github.com/repos/novoda/download-manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/novoda/download-manager/merges","archive_url":"https://api.github.com/repos/novoda/download-manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/novoda/download-manager/downloads","issues_url":"https://api.github.com/repos/novoda/download-manager/issues{/number}","pulls_url":"https://api.github.com/repos/novoda/download-manager/pulls{/number}","milestones_url":"https://api.github.com/repos/novoda/download-manager/milestones{/number}","notifications_url":"https://api.github.com/repos/novoda/download-manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/novoda/download-manager/labels{/name}","releases_url":"https://api.github.com/repos/novoda/download-manager/releases{/id}","deployments_url":"https://api.github.com/repos/novoda/download-manager/deployments","created_at":"2015-05-07T09:41:52Z","updated_at":"2018-02-28T07:15:54Z","pushed_at":"2018-03-08T15:12:42Z","git_url":"git://github.com/novoda/download-manager.git","ssh_url":"git@github.com:novoda/download-manager.git","clone_url":"https://github.com/novoda/download-manager.git","svn_url":"https://github.com/novoda/download-manager","homepage":"","size":239401,"stargazers_count":133,"watchers_count":133,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"open_issues_count":52,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":30,"open_issues":52,"watchers":133,"default_branch":"master"}},"base":{"label":"novoda:epic_download_manager_v2","ref":"epic_download_manager_v2","sha":"87d736b2b4b7d0079746cf9855a7758c427acaaf","user":{"login":"novoda","id":74874,"avatar_url":"https://avatars2.githubusercontent.com/u/74874?v=4","gravatar_id":"","url":"https://api.github.com/users/novoda","html_url":"https://github.com/novoda","followers_url":"https://api.github.com/users/novoda/followers","following_url":"https://api.github.com/users/novoda/following{/other_user}","gists_url":"https://api.github.com/users/novoda/gists{/gist_id}","starred_url":"https://api.github.com/users/novoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novoda/subscriptions","organizations_url":"https://api.github.com/users/novoda/orgs","repos_url":"https://api.github.com/users/novoda/repos","events_url":"https://api.github.com/users/novoda/events{/privacy}","received_events_url":"https://api.github.com/users/novoda/received_events","type":"Organization","site_admin":false},"repo":{"id":35211795,"name":"download-manager","full_name":"novoda/download-manager","owner":{"login":"novoda","id":74874,"avatar_url":"https://avatars2.githubusercontent.com/u/74874?v=4","gravatar_id":"","url":"https://api.github.com/users/novoda","html_url":"https://github.com/novoda","followers_url":"https://api.github.com/users/novoda/followers","following_url":"https://api.github.com/users/novoda/following{/other_user}","gists_url":"https://api.github.com/users/novoda/gists{/gist_id}","starred_url":"https://api.github.com/users/novoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novoda/subscriptions","organizations_url":"https://api.github.com/users/novoda/orgs","repos_url":"https://api.github.com/users/novoda/repos","events_url":"https://api.github.com/users/novoda/events{/privacy}","received_events_url":"https://api.github.com/users/novoda/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/novoda/download-manager","description":"Download manager based on AOSP DM but allowing downloading to internal private storage","fork":false,"url":"https://api.github.com/repos/novoda/download-manager","forks_url":"https://api.github.com/repos/novoda/download-manager/forks","keys_url":"https://api.github.com/repos/novoda/download-manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/novoda/download-manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/novoda/download-manager/teams","hooks_url":"https://api.github.com/repos/novoda/download-manager/hooks","issue_events_url":"https://api.github.com/repos/novoda/download-manager/issues/events{/number}","events_url":"https://api.github.com/repos/novoda/download-manager/events","assignees_url":"https://api.github.com/repos/novoda/download-manager/assignees{/user}","branches_url":"https://api.github.com/repos/novoda/download-manager/branches{/branch}","tags_url":"https://api.github.com/repos/novoda/download-manager/tags","blobs_url":"https://api.github.com/repos/novoda/download-manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/novoda/download-manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/novoda/download-manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/novoda/download-manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/novoda/download-manager/statuses/{sha}","languages_url":"https://api.github.com/repos/novoda/download-manager/languages","stargazers_url":"https://api.github.com/repos/novoda/download-manager/stargazers","contributors_url":"https://api.github.com/repos/novoda/download-manager/contributors","subscribers_url":"https://api.github.com/repos/novoda/download-manager/subscribers","subscription_url":"https://api.github.com/repos/novoda/download-manager/subscription","commits_url":"https://api.github.com/repos/novoda/download-manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/novoda/download-manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/novoda/download-manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/novoda/download-manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/novoda/download-manager/contents/{+path}","compare_url":"https://api.github.com/repos/novoda/download-manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/novoda/download-manager/merges","archive_url":"https://api.github.com/repos/novoda/download-manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/novoda/download-manager/downloads","issues_url":"https://api.github.com/repos/novoda/download-manager/issues{/number}","pulls_url":"https://api.github.com/repos/novoda/download-manager/pulls{/number}","milestones_url":"https://api.github.com/repos/novoda/download-manager/milestones{/number}","notifications_url":"https://api.github.com/repos/novoda/download-manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/novoda/download-manager/labels{/name}","releases_url":"https://api.github.com/repos/novoda/download-manager/releases{/id}","deployments_url":"https://api.github.com/repos/novoda/download-manager/deployments","created_at":"2015-05-07T09:41:52Z","updated_at":"2018-02-28T07:15:54Z","pushed_at":"2018-03-08T15:12:42Z","git_url":"git://github.com/novoda/download-manager.git","ssh_url":"git@github.com:novoda/download-manager.git","clone_url":"https://github.com/novoda/download-manager.git","svn_url":"https://github.com/novoda/download-manager","homepage":"","size":239401,"stargazers_count":133,"watchers_count":133,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"open_issues_count":52,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":30,"open_issues":52,"watchers":133,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/novoda/download-manager/pulls/359"},"html":{"href":"https://github.com/novoda/download-manager/pull/359"},"issue":{"href":"https://api.github.com/repos/novoda/download-manager/issues/359"},"comments":{"href":"https://api.github.com/repos/novoda/download-manager/issues/359/comments"},"review_comments":{"href":"https://api.github.com/repos/novoda/download-manager/pulls/359/comments"},"review_comment":{"href":"https://api.github.com/repos/novoda/download-manager/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/novoda/download-manager/pulls/359/commits"},"statuses":{"href":"https://api.github.com/repos/novoda/download-manager/statuses/c651c1edaa20922455948485416e9c9175cab41f"}},"author_association":"OWNER","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"zegnus","id":2845931,"avatar_url":"https://avatars3.githubusercontent.com/u/2845931?v=4","gravatar_id":"","url":"https://api.github.com/users/zegnus","html_url":"https://github.com/zegnus","followers_url":"https://api.github.com/users/zegnus/followers","following_url":"https://api.github.com/users/zegnus/following{/other_user}","gists_url":"https://api.github.com/users/zegnus/gists{/gist_id}","starred_url":"https://api.github.com/users/zegnus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zegnus/subscriptions","organizations_url":"https://api.github.com/users/zegnus/orgs","repos_url":"https://api.github.com/users/zegnus/repos","events_url":"https://api.github.com/users/zegnus/events{/privacy}","received_events_url":"https://api.github.com/users/zegnus/received_events","type":"User","site_admin":false},"comments":2,"review_comments":22,"maintainer_can_modify":false,"commits":22,"additions":231,"deletions":127,"changed_files":14}}
{"actor":{"display_login":"zegnus"}}