{"action":"created","issue":{"url":"https://api.github.com/repos/clojureverse/clojurians-log-app/issues/46","repository_url":"https://api.github.com/repos/clojureverse/clojurians-log-app","labels_url":"https://api.github.com/repos/clojureverse/clojurians-log-app/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/clojureverse/clojurians-log-app/issues/46/comments","events_url":"https://api.github.com/repos/clojureverse/clojurians-log-app/issues/46/events","html_url":"https://github.com/clojureverse/clojurians-log-app/pull/46","id":324614574,"number":46,"title":"Faster thread-message query","user":{"login":"Odie","id":10692,"avatar_url":"https://avatars3.githubusercontent.com/u/10692?v=4","gravatar_id":"","url":"https://api.github.com/users/Odie","html_url":"https://github.com/Odie","followers_url":"https://api.github.com/users/Odie/followers","following_url":"https://api.github.com/users/Odie/following{/other_user}","gists_url":"https://api.github.com/users/Odie/gists{/gist_id}","starred_url":"https://api.github.com/users/Odie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Odie/subscriptions","organizations_url":"https://api.github.com/users/Odie/orgs","repos_url":"https://api.github.com/users/Odie/repos","events_url":"https://api.github.com/users/Odie/events{/privacy}","received_events_url":"https://api.github.com/users/Odie/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-19T09:02:40Z","updated_at":"2018-05-22T10:20:29Z","closed_at":"2018-05-22T08:23:09Z","author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/clojureverse/clojurians-log-app/pulls/46","html_url":"https://github.com/clojureverse/clojurians-log-app/pull/46","diff_url":"https://github.com/clojureverse/clojurians-log-app/pull/46.diff","patch_url":"https://github.com/clojureverse/clojurians-log-app/pull/46.patch"},"body":"This PR makes fetching thread messages much faster.\r\n\r\nAs mentioned in #39, the basic idea here is to write a new query that retrieves thread messages based on the :message/ts of the thread parents.\r\n\r\nQuick measurement on the dev machine:\r\n\r\nroute | potential parent messages | Old query | New query\r\n------|---------------------------|-----------|------------\r\nfigwheel/2018-04-05 | 10            | 2356 ms | 92 ms\r\ndatomic/2015-08-19 | 212           | 2407 ms | 435 ms\r\nclojurescript/2015-11-25 | 487    | 2527 ms | 999 ms\r\nclojure/2017-03-08    | 679         | 2652 ms | 1397 ms\r\n\r\nThere is a code snippet left at the end of queries.clj you can use to compare the performance of the old and new query. Looks like the performance of the old query is based on the total number of messages in the database. Performance of the new query depends on how many potential parent threads we're asking to retrieve. The new query can still fairly slow in cases where the channel has lots of messages, but should be much faster in most cases.\r\n\r\n---\r\n\r\n- [x] My code conforms to this project's [Style Guide](https://github.com/clojureverse/clojurians-log-app/blob/master/docs/STYLE.md)\r\n- [ ] I have added tests for functions or features I've added\r\n- [x] All tests are green (`lein test`)\r\n"},"comment":{"url":"https://api.github.com/repos/clojureverse/clojurians-log-app/issues/comments/390940158","html_url":"https://github.com/clojureverse/clojurians-log-app/pull/46#issuecomment-390940158","issue_url":"https://api.github.com/repos/clojureverse/clojurians-log-app/issues/46","id":390940158,"user":{"login":"plexus","id":32212,"avatar_url":"https://avatars2.githubusercontent.com/u/32212?v=4","gravatar_id":"","url":"https://api.github.com/users/plexus","html_url":"https://github.com/plexus","followers_url":"https://api.github.com/users/plexus/followers","following_url":"https://api.github.com/users/plexus/following{/other_user}","gists_url":"https://api.github.com/users/plexus/gists{/gist_id}","starred_url":"https://api.github.com/users/plexus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plexus/subscriptions","organizations_url":"https://api.github.com/users/plexus/orgs","repos_url":"https://api.github.com/users/plexus/repos","events_url":"https://api.github.com/users/plexus/events{/privacy}","received_events_url":"https://api.github.com/users/plexus/received_events","type":"User","site_admin":false},"created_at":"2018-05-22T10:20:29Z","updated_at":"2018-05-22T10:20:29Z","author_association":"COLLABORATOR","body":"Thanks @danielcompton , I've updated the settings"}}
{"actor":{"display_login":"plexus"}}