{"action":"created","issue":{"url":"https://api.github.com/repos/scragg0x/realms-wiki/issues/147","repository_url":"https://api.github.com/repos/scragg0x/realms-wiki","labels_url":"https://api.github.com/repos/scragg0x/realms-wiki/issues/147/labels{/name}","comments_url":"https://api.github.com/repos/scragg0x/realms-wiki/issues/147/comments","events_url":"https://api.github.com/repos/scragg0x/realms-wiki/issues/147/events","html_url":"https://github.com/scragg0x/realms-wiki/pull/147","id":163761078,"number":147,"title":"Create WikiPage class to encapsulate wiki page functions","user":{"login":"gazpachoking","id":187133,"avatar_url":"https://avatars.githubusercontent.com/u/187133?v=3","gravatar_id":"","url":"https://api.github.com/users/gazpachoking","html_url":"https://github.com/gazpachoking","followers_url":"https://api.github.com/users/gazpachoking/followers","following_url":"https://api.github.com/users/gazpachoking/following{/other_user}","gists_url":"https://api.github.com/users/gazpachoking/gists{/gist_id}","starred_url":"https://api.github.com/users/gazpachoking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gazpachoking/subscriptions","organizations_url":"https://api.github.com/users/gazpachoking/orgs","repos_url":"https://api.github.com/users/gazpachoking/repos","events_url":"https://api.github.com/users/gazpachoking/events{/privacy}","received_events_url":"https://api.github.com/users/gazpachoking/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-05T02:28:12Z","updated_at":"2016-07-05T15:19:39Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scragg0x/realms-wiki/pulls/147","html_url":"https://github.com/scragg0x/realms-wiki/pull/147","diff_url":"https://github.com/scragg0x/realms-wiki/pull/147.diff","patch_url":"https://github.com/scragg0x/realms-wiki/pull/147.patch"},"body":"I was looking in to #145, and discovered that wiki.get_history was very slow when the repo had a lot of commits, even when limited to the first entry, like wiki.get_page was using to fill the page['info'] dict. I also noticed that most usages of get_page didn't even use the provided info dict.\r\n\r\nThis PR refactors wiki.get_page() to return a new class, `WikiPage`, which has `data`, `info`, and `partials` properties, lazily loaded when accessed. This means the expensive `info` property never needs to be loaded when browsing the site normally.\r\n\r\nThe WikiPage class is also the only thing that touches the cache now, and the `data` and `info` property are cached separately.\r\n\r\nI'm developing on Windows at the moment, and haven't gotten my testing environment set up yet, so there may be a couple tweaks needed, including this known one:\r\n- [ ] WikiPage boolean value should be true only when page exists at given hash [link] (https://github.com/gazpachoking/realms-wiki/blob/page_class/realms/modules/wiki/models.py#L313-L315) (does anyone know how to do that?)\r\n- [ ] fix the tests\r\n\r\nOther possible improvements: getting the full history is veeeerrrryyy slow when there is a big commit history. Perhaps that should also be cached. It would be nicer if we could figure a way to speed up the first load as well though. A lesser optimization would be to have history load up the `info` cache, to get the latest commit that affects the file, and walk the ancestry tree from there, would be variable how much that speeds things up, but for files that haven't been touched in a while it could be quite a bit."},"comment":{"url":"https://api.github.com/repos/scragg0x/realms-wiki/issues/comments/230510031","html_url":"https://github.com/scragg0x/realms-wiki/pull/147#issuecomment-230510031","issue_url":"https://api.github.com/repos/scragg0x/realms-wiki/issues/147","id":230510031,"user":{"login":"scragg0x","id":222611,"avatar_url":"https://avatars.githubusercontent.com/u/222611?v=3","gravatar_id":"","url":"https://api.github.com/users/scragg0x","html_url":"https://github.com/scragg0x","followers_url":"https://api.github.com/users/scragg0x/followers","following_url":"https://api.github.com/users/scragg0x/following{/other_user}","gists_url":"https://api.github.com/users/scragg0x/gists{/gist_id}","starred_url":"https://api.github.com/users/scragg0x/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scragg0x/subscriptions","organizations_url":"https://api.github.com/users/scragg0x/orgs","repos_url":"https://api.github.com/users/scragg0x/repos","events_url":"https://api.github.com/users/scragg0x/events{/privacy}","received_events_url":"https://api.github.com/users/scragg0x/received_events","type":"User","site_admin":false},"created_at":"2016-07-05T15:19:39Z","updated_at":"2016-07-05T15:19:39Z","body":"I like it, it looks good.  I haven't used realms with a large repo so I haven't experienced a slow down but what you say makes sense."}}
{"actor":{"display_login":"scragg0x"}}