{"action":"created","comment":{"url":"https://api.github.com/repos/learningequality/ka-lite/pulls/comments/41073057","id":41073057,"diff_hunk":"@@ -395,11 +394,21 @@ def annotate_content_models(db=None, channel=\"khan\", language=\"en\", ids=None, **\n     Our ids can be duplicated at the moment, so this may be several content items per id.\n     When a content item has been updated, propagate availability up the topic tree.\n     \"\"\"\n-    content_models = get_content_items(ids=ids, channel=channel, language=language)\n-    updates_dict = update_content_availability(content_models)\n+    def iterator_content_items(ids=None, **kwargs):\n+        if ids:\n+            items = Item.select().where(Item.id.in_(ids)).dicts().iterator()\n+        else:\n+            items = Item.select().dicts().iterator()\n \n-    with Using(db, [Item]):\n+        mapped_items = itertools.imap(unparse_model_data, items)\n+\n+        updated_mapped_items = update_content_availability(mapped_items)","path":"kalite/topic_tools/content_models.py","position":69,"original_position":69,"commit_id":"954589d3c779d9764acf4002a9533736c6946f80","original_commit_id":"954589d3c779d9764acf4002a9533736c6946f80","user":{"login":"rtibbles","id":1680573,"avatar_url":"https://avatars.githubusercontent.com/u/1680573?v=3","gravatar_id":"","url":"https://api.github.com/users/rtibbles","html_url":"https://github.com/rtibbles","followers_url":"https://api.github.com/users/rtibbles/followers","following_url":"https://api.github.com/users/rtibbles/following{/other_user}","gists_url":"https://api.github.com/users/rtibbles/gists{/gist_id}","starred_url":"https://api.github.com/users/rtibbles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtibbles/subscriptions","organizations_url":"https://api.github.com/users/rtibbles/orgs","repos_url":"https://api.github.com/users/rtibbles/repos","events_url":"https://api.github.com/users/rtibbles/events{/privacy}","received_events_url":"https://api.github.com/users/rtibbles/received_events","type":"User","site_admin":false},"body":"As mentioned verbally, we should modify ```update_content_availability``` to be a generator too, otherwise this will just cause inflation again.","created_at":"2015-10-02T22:12:42Z","updated_at":"2015-10-02T22:12:42Z","html_url":"https://github.com/learningequality/ka-lite/pull/4551#discussion_r41073057","pull_request_url":"https://api.github.com/repos/learningequality/ka-lite/pulls/4551","_links":{"self":{"href":"https://api.github.com/repos/learningequality/ka-lite/pulls/comments/41073057"},"html":{"href":"https://github.com/learningequality/ka-lite/pull/4551#discussion_r41073057"},"pull_request":{"href":"https://api.github.com/repos/learningequality/ka-lite/pulls/4551"}}},"pull_request":{"url":"https://api.github.com/repos/learningequality/ka-lite/pulls/4551","id":46562639,"html_url":"https://github.com/learningequality/ka-lite/pull/4551","diff_url":"https://github.com/learningequality/ka-lite/pull/4551.diff","patch_url":"https://github.com/learningequality/ka-lite/pull/4551.patch","issue_url":"https://api.github.com/repos/learningequality/ka-lite/issues/4551","number":4551,"state":"open","locked":false,"title":"annotate_content_models has been optimized and memory overhead reduce…","user":{"login":"gwong89","id":728388,"avatar_url":"https://avatars.githubusercontent.com/u/728388?v=3","gravatar_id":"","url":"https://api.github.com/users/gwong89","html_url":"https://github.com/gwong89","followers_url":"https://api.github.com/users/gwong89/followers","following_url":"https://api.github.com/users/gwong89/following{/other_user}","gists_url":"https://api.github.com/users/gwong89/gists{/gist_id}","starred_url":"https://api.github.com/users/gwong89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gwong89/subscriptions","organizations_url":"https://api.github.com/users/gwong89/orgs","repos_url":"https://api.github.com/users/gwong89/repos","events_url":"https://api.github.com/users/gwong89/events{/privacy}","received_events_url":"https://api.github.com/users/gwong89/received_events","type":"User","site_admin":false},"body":"…d by 40% from original\r\n\r\n@rtibbles  Me and @aronasorman  were wondering if the update check is necessary since it looks like all contents are not empty? line 433 in content_models.py\r\n\r\nhere  is the gist with the new improvment\r\n\r\nhttps://gist.github.com/gwong89/bc11bbd727eeb715e292\r\n","created_at":"2015-10-01T18:58:33Z","updated_at":"2015-10-02T22:12:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c356df279b3941274fbbf0db78d670678cc41003","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/learningequality/ka-lite/pulls/4551/commits","review_comments_url":"https://api.github.com/repos/learningequality/ka-lite/pulls/4551/comments","review_comment_url":"https://api.github.com/repos/learningequality/ka-lite/pulls/comments{/number}","comments_url":"https://api.github.com/repos/learningequality/ka-lite/issues/4551/comments","statuses_url":"https://api.github.com/repos/learningequality/ka-lite/statuses/954589d3c779d9764acf4002a9533736c6946f80","head":{"label":"gwong89:benchmark","ref":"benchmark","sha":"954589d3c779d9764acf4002a9533736c6946f80","user":{"login":"gwong89","id":728388,"avatar_url":"https://avatars.githubusercontent.com/u/728388?v=3","gravatar_id":"","url":"https://api.github.com/users/gwong89","html_url":"https://github.com/gwong89","followers_url":"https://api.github.com/users/gwong89/followers","following_url":"https://api.github.com/users/gwong89/following{/other_user}","gists_url":"https://api.github.com/users/gwong89/gists{/gist_id}","starred_url":"https://api.github.com/users/gwong89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gwong89/subscriptions","organizations_url":"https://api.github.com/users/gwong89/orgs","repos_url":"https://api.github.com/users/gwong89/repos","events_url":"https://api.github.com/users/gwong89/events{/privacy}","received_events_url":"https://api.github.com/users/gwong89/received_events","type":"User","site_admin":false},"repo":{"id":42702995,"name":"ka-lite","full_name":"gwong89/ka-lite","owner":{"login":"gwong89","id":728388,"avatar_url":"https://avatars.githubusercontent.com/u/728388?v=3","gravatar_id":"","url":"https://api.github.com/users/gwong89","html_url":"https://github.com/gwong89","followers_url":"https://api.github.com/users/gwong89/followers","following_url":"https://api.github.com/users/gwong89/following{/other_user}","gists_url":"https://api.github.com/users/gwong89/gists{/gist_id}","starred_url":"https://api.github.com/users/gwong89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gwong89/subscriptions","organizations_url":"https://api.github.com/users/gwong89/orgs","repos_url":"https://api.github.com/users/gwong89/repos","events_url":"https://api.github.com/users/gwong89/events{/privacy}","received_events_url":"https://api.github.com/users/gwong89/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gwong89/ka-lite","description":"KA Lite: lightweight web server for serving core Khan Academy content (videos and exercises) without needing internet connectivity","fork":true,"url":"https://api.github.com/repos/gwong89/ka-lite","forks_url":"https://api.github.com/repos/gwong89/ka-lite/forks","keys_url":"https://api.github.com/repos/gwong89/ka-lite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gwong89/ka-lite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gwong89/ka-lite/teams","hooks_url":"https://api.github.com/repos/gwong89/ka-lite/hooks","issue_events_url":"https://api.github.com/repos/gwong89/ka-lite/issues/events{/number}","events_url":"https://api.github.com/repos/gwong89/ka-lite/events","assignees_url":"https://api.github.com/repos/gwong89/ka-lite/assignees{/user}","branches_url":"https://api.github.com/repos/gwong89/ka-lite/branches{/branch}","tags_url":"https://api.github.com/repos/gwong89/ka-lite/tags","blobs_url":"https://api.github.com/repos/gwong89/ka-lite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gwong89/ka-lite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gwong89/ka-lite/git/refs{/sha}","trees_url":"https://api.github.com/repos/gwong89/ka-lite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gwong89/ka-lite/statuses/{sha}","languages_url":"https://api.github.com/repos/gwong89/ka-lite/languages","stargazers_url":"https://api.github.com/repos/gwong89/ka-lite/stargazers","contributors_url":"https://api.github.com/repos/gwong89/ka-lite/contributors","subscribers_url":"https://api.github.com/repos/gwong89/ka-lite/subscribers","subscription_url":"https://api.github.com/repos/gwong89/ka-lite/subscription","commits_url":"https://api.github.com/repos/gwong89/ka-lite/commits{/sha}","git_commits_url":"https://api.github.com/repos/gwong89/ka-lite/git/commits{/sha}","comments_url":"https://api.github.com/repos/gwong89/ka-lite/comments{/number}","issue_comment_url":"https://api.github.com/repos/gwong89/ka-lite/issues/comments{/number}","contents_url":"https://api.github.com/repos/gwong89/ka-lite/contents/{+path}","compare_url":"https://api.github.com/repos/gwong89/ka-lite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gwong89/ka-lite/merges","archive_url":"https://api.github.com/repos/gwong89/ka-lite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gwong89/ka-lite/downloads","issues_url":"https://api.github.com/repos/gwong89/ka-lite/issues{/number}","pulls_url":"https://api.github.com/repos/gwong89/ka-lite/pulls{/number}","milestones_url":"https://api.github.com/repos/gwong89/ka-lite/milestones{/number}","notifications_url":"https://api.github.com/repos/gwong89/ka-lite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gwong89/ka-lite/labels{/name}","releases_url":"https://api.github.com/repos/gwong89/ka-lite/releases{/id}","created_at":"2015-09-18T06:07:06Z","updated_at":"2015-09-18T06:07:19Z","pushed_at":"2015-10-01T20:56:29Z","git_url":"git://github.com/gwong89/ka-lite.git","ssh_url":"git@github.com:gwong89/ka-lite.git","clone_url":"https://github.com/gwong89/ka-lite.git","svn_url":"https://github.com/gwong89/ka-lite","homepage":"https://learningequality.org/ka-lite/","size":169448,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"learningequality:develop","ref":"develop","sha":"f9f2fc3aaf3e42733e08b89346d7b7a420d99d18","user":{"login":"learningequality","id":3926525,"avatar_url":"https://avatars.githubusercontent.com/u/3926525?v=3","gravatar_id":"","url":"https://api.github.com/users/learningequality","html_url":"https://github.com/learningequality","followers_url":"https://api.github.com/users/learningequality/followers","following_url":"https://api.github.com/users/learningequality/following{/other_user}","gists_url":"https://api.github.com/users/learningequality/gists{/gist_id}","starred_url":"https://api.github.com/users/learningequality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/learningequality/subscriptions","organizations_url":"https://api.github.com/users/learningequality/orgs","repos_url":"https://api.github.com/users/learningequality/repos","events_url":"https://api.github.com/users/learningequality/events{/privacy}","received_events_url":"https://api.github.com/users/learningequality/received_events","type":"Organization","site_admin":false},"repo":{"id":5741125,"name":"ka-lite","full_name":"learningequality/ka-lite","owner":{"login":"learningequality","id":3926525,"avatar_url":"https://avatars.githubusercontent.com/u/3926525?v=3","gravatar_id":"","url":"https://api.github.com/users/learningequality","html_url":"https://github.com/learningequality","followers_url":"https://api.github.com/users/learningequality/followers","following_url":"https://api.github.com/users/learningequality/following{/other_user}","gists_url":"https://api.github.com/users/learningequality/gists{/gist_id}","starred_url":"https://api.github.com/users/learningequality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/learningequality/subscriptions","organizations_url":"https://api.github.com/users/learningequality/orgs","repos_url":"https://api.github.com/users/learningequality/repos","events_url":"https://api.github.com/users/learningequality/events{/privacy}","received_events_url":"https://api.github.com/users/learningequality/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/learningequality/ka-lite","description":"KA Lite: lightweight web server for serving core Khan Academy content (videos and exercises) without needing internet connectivity","fork":false,"url":"https://api.github.com/repos/learningequality/ka-lite","forks_url":"https://api.github.com/repos/learningequality/ka-lite/forks","keys_url":"https://api.github.com/repos/learningequality/ka-lite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/learningequality/ka-lite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/learningequality/ka-lite/teams","hooks_url":"https://api.github.com/repos/learningequality/ka-lite/hooks","issue_events_url":"https://api.github.com/repos/learningequality/ka-lite/issues/events{/number}","events_url":"https://api.github.com/repos/learningequality/ka-lite/events","assignees_url":"https://api.github.com/repos/learningequality/ka-lite/assignees{/user}","branches_url":"https://api.github.com/repos/learningequality/ka-lite/branches{/branch}","tags_url":"https://api.github.com/repos/learningequality/ka-lite/tags","blobs_url":"https://api.github.com/repos/learningequality/ka-lite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/learningequality/ka-lite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/learningequality/ka-lite/git/refs{/sha}","trees_url":"https://api.github.com/repos/learningequality/ka-lite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/learningequality/ka-lite/statuses/{sha}","languages_url":"https://api.github.com/repos/learningequality/ka-lite/languages","stargazers_url":"https://api.github.com/repos/learningequality/ka-lite/stargazers","contributors_url":"https://api.github.com/repos/learningequality/ka-lite/contributors","subscribers_url":"https://api.github.com/repos/learningequality/ka-lite/subscribers","subscription_url":"https://api.github.com/repos/learningequality/ka-lite/subscription","commits_url":"https://api.github.com/repos/learningequality/ka-lite/commits{/sha}","git_commits_url":"https://api.github.com/repos/learningequality/ka-lite/git/commits{/sha}","comments_url":"https://api.github.com/repos/learningequality/ka-lite/comments{/number}","issue_comment_url":"https://api.github.com/repos/learningequality/ka-lite/issues/comments{/number}","contents_url":"https://api.github.com/repos/learningequality/ka-lite/contents/{+path}","compare_url":"https://api.github.com/repos/learningequality/ka-lite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/learningequality/ka-lite/merges","archive_url":"https://api.github.com/repos/learningequality/ka-lite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/learningequality/ka-lite/downloads","issues_url":"https://api.github.com/repos/learningequality/ka-lite/issues{/number}","pulls_url":"https://api.github.com/repos/learningequality/ka-lite/pulls{/number}","milestones_url":"https://api.github.com/repos/learningequality/ka-lite/milestones{/number}","notifications_url":"https://api.github.com/repos/learningequality/ka-lite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/learningequality/ka-lite/labels{/name}","releases_url":"https://api.github.com/repos/learningequality/ka-lite/releases{/id}","created_at":"2012-09-09T20:01:40Z","updated_at":"2015-09-25T13:26:48Z","pushed_at":"2015-10-02T21:55:18Z","git_url":"git://github.com/learningequality/ka-lite.git","ssh_url":"git@github.com:learningequality/ka-lite.git","clone_url":"https://github.com/learningequality/ka-lite.git","svn_url":"https://github.com/learningequality/ka-lite","homepage":"https://learningequality.org/ka-lite/","size":250838,"stargazers_count":237,"watchers_count":237,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":259,"mirror_url":null,"open_issues_count":259,"forks":259,"open_issues":259,"watchers":237,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/learningequality/ka-lite/pulls/4551"},"html":{"href":"https://github.com/learningequality/ka-lite/pull/4551"},"issue":{"href":"https://api.github.com/repos/learningequality/ka-lite/issues/4551"},"comments":{"href":"https://api.github.com/repos/learningequality/ka-lite/issues/4551/comments"},"review_comments":{"href":"https://api.github.com/repos/learningequality/ka-lite/pulls/4551/comments"},"review_comment":{"href":"https://api.github.com/repos/learningequality/ka-lite/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/learningequality/ka-lite/pulls/4551/commits"},"statuses":{"href":"https://api.github.com/repos/learningequality/ka-lite/statuses/954589d3c779d9764acf4002a9533736c6946f80"}}}}