{"action":"created","issue":{"url":"https://api.github.com/repos/novoda/download-manager/issues/75","labels_url":"https://api.github.com/repos/novoda/download-manager/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/novoda/download-manager/issues/75/comments","events_url":"https://api.github.com/repos/novoda/download-manager/issues/75/events","html_url":"https://github.com/novoda/download-manager/pull/75","id":93578161,"number":75,"title":"Calculate entire batch size in one go","user":{"login":"ouchadam","id":1848238,"avatar_url":"https://avatars.githubusercontent.com/u/1848238?v=3","gravatar_id":"","url":"https://api.github.com/users/ouchadam","html_url":"https://github.com/ouchadam","followers_url":"https://api.github.com/users/ouchadam/followers","following_url":"https://api.github.com/users/ouchadam/following{/other_user}","gists_url":"https://api.github.com/users/ouchadam/gists{/gist_id}","starred_url":"https://api.github.com/users/ouchadam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ouchadam/subscriptions","organizations_url":"https://api.github.com/users/ouchadam/orgs","repos_url":"https://api.github.com/users/ouchadam/repos","events_url":"https://api.github.com/users/ouchadam/events{/privacy}","received_events_url":"https://api.github.com/users/ouchadam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-07T16:55:38Z","updated_at":"2015-07-07T17:33:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/novoda/download-manager/pulls/75","html_url":"https://github.com/novoda/download-manager/pull/75","diff_url":"https://github.com/novoda/download-manager/pull/75.diff","patch_url":"https://github.com/novoda/download-manager/pull/75.patch"},"body":"Forces the download batch to be fully sized up before hitting the `isAllowedToDownload()` rules and download thread\r\n\r\nFixes `isAllowedToDownload` being called with -1 total size\r\n\r\nRemoves the cached `mDownloads`, they were being used as a back up to when the content provider failed(?!) **BUT** if the content provider failed we wouldn't be able to read from the map anyways because we were calling `contentResolver.query().getLong(id)`... ! Removing them super simplified the download flow and due to the reuse of the download batches and download infos, we no longer have to query on each iteration of the loop, performance increased!\r\n\r\nLogs taken at the start and end of `updateLocked()` in the `DownloadService`\r\n\r\nBefore 119, 118, 87, 91, 113, 139, 63, 61, 62, 65 average = **91.8ms**\r\nAfter 75, 6, 4, 5, 4, 3, 4, 3, 4, 3 average = **11.1ms**\r\n\r\nalmost 10x increase...."},"comment":{"url":"https://api.github.com/repos/novoda/download-manager/issues/comments/119277185","html_url":"https://github.com/novoda/download-manager/pull/75#issuecomment-119277185","issue_url":"https://api.github.com/repos/novoda/download-manager/issues/75","id":119277185,"user":{"login":"ouchadam","id":1848238,"avatar_url":"https://avatars.githubusercontent.com/u/1848238?v=3","gravatar_id":"","url":"https://api.github.com/users/ouchadam","html_url":"https://github.com/ouchadam","followers_url":"https://api.github.com/users/ouchadam/followers","following_url":"https://api.github.com/users/ouchadam/following{/other_user}","gists_url":"https://api.github.com/users/ouchadam/gists{/gist_id}","starred_url":"https://api.github.com/users/ouchadam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ouchadam/subscriptions","organizations_url":"https://api.github.com/users/ouchadam/orgs","repos_url":"https://api.github.com/users/ouchadam/repos","events_url":"https://api.github.com/users/ouchadam/events{/privacy}","received_events_url":"https://api.github.com/users/ouchadam/received_events","type":"User","site_admin":false},"created_at":"2015-07-07T17:33:14Z","updated_at":"2015-07-07T17:33:14Z","body":"stats delivered :book: "}}