Commit Graph

152 Commits

Author SHA1 Message Date
Guo Xiang Tan 711371e8c8 FIX: Select+below will ask server for post ids on megatopics. 2018-07-13 15:10:39 +08:00
Guo Xiang Tan c722b07057 FIX: `/t/:topic_id/last` route did not return any posts. 2018-07-13 14:26:10 +08:00
David Taylor 81f9500f5c
FIX: Change megatopic threshold to 10,000 posts 2018-07-12 22:00:53 +01:00
Guo Xiang Tan 258e9e35ca PERF: Make mega topics work without a stream.
There are tradeoffs that we took here. For the complete
story see
https://meta.discourse.org/t/performance-improvements-on-long-topics/30187/27?u=tgxworld.
2018-07-12 12:46:12 +08:00
Guo Xiang Tan b4e1388f9b PERF: Drop support for gaps in mega topics.
Based on our current implementation, there isn't a
practical way to determine the gaps of large topics
cheaply. We tried to load the gaps in chunks but felt
that the code becomes too complicated. Note that
megatopics are quite rare in the wild.
2018-07-10 16:27:02 +08:00
Guo Xiang Tan 21f333654c REFACTOR: Reduce dependency on the post stream in `TopicView`.
This will allow us to drop the post stream from the payload for
mega-topics. On smaller topics, the extra query is fast because
of an existing index.
2018-07-10 15:53:00 +08:00
Guo Xiang Tan 252e5574cc FIX: Prevent ambigous column errors when joining `TopicView` queries. 2018-06-29 10:33:08 +08:00
Guo Xiang Tan eb427f7cf4 PERF: Update `TopicView#participant_count` to use `Topic#posts_count`.
Use the counter cache instead of hitting the DB and plucking
every single id.
2018-06-27 17:18:47 +08:00
Guo Xiang Tan cfa7898c2d Rename `TopicView#last_read_post_id` to `TopicView#filtered_post_id`. 2018-06-27 12:33:57 +08:00
Guo Xiang Tan cb69888758 PERF: Don't pluck all the columns just to retrieve a single value. 2018-06-27 11:41:35 +08:00
Guo Xiang Tan 49ffc1eb61 Revert "PERF: Send down gaps as the relevant posts load instead of front loading."
This reverts commit 4c3352528e.
2018-06-26 12:54:14 +08:00
Guo Xiang Tan 4c3352528e PERF: Send down gaps as the relevant posts load instead of front loading. 2018-06-26 12:49:06 +08:00
Guo Xiang Tan 0b6a2e9d1f Remove force summary mode for megatopics for now.
The logic is too hairy and we can't reliably determine
when to force summary mode. Work is underway to improve
perf for megatopics so this will not be required
eventually.
2018-06-26 12:49:06 +08:00
Guo Xiang Tan 5100a62fc0 FIX: Megatopics forced into summary mode when loading posts. 2018-06-25 22:11:56 +08:00
Guo Xiang Tan f69356e628 FIX: Users can't "show all posts" in forced summary topics. 2018-06-22 11:32:45 +08:00
Guo Xiang Tan 9a7a079f4d Force summary mode when user enters at the top of megalodoon topics. 2018-06-21 15:18:52 +08:00
Guo Xiang Tan f7d22bad90 FEATURE: Forced summary mode for megalodon topics.
This is mainly done for performance reasons and megalodon
topics are usually a byproduct of imports where site setting
limits are not respected.
2018-06-21 14:00:20 +08:00
Guo Xiang Tan 5cef4e281b PERF: Memoize `TopicView#gaps` results. 2018-06-21 12:37:24 +08:00
Sam 2d59d06916 PERF: mega_topics get no post counts per user 2018-06-21 11:09:45 +10:00
Guo Xiang Tan ff5fc3cb08 Use a fixed limit for mega topic posts count. 2018-06-20 16:58:52 +08:00
Guo Xiang Tan 9c925a66ff PERF: Don't display days ago on timeline for megatopics.
Analysis using `pg_stat_statements` showed this query
to be eating up a significant portion of CPU.
2018-06-20 16:25:54 +08:00
Sam cbdab71179 PERF: stop counting participants on very large topics
This query gets very expensive and can be bypassed on large topics
2018-06-20 18:11:39 +10:00
Sam 5f64fd0a21 DEV: remove exec_sql and replace with mini_sql
Introduce new patterns for direct sql that are safe and fast.

MiniSql is not prone to memory bloat that can happen with direct PG usage.
It also has an extremely fast materializer and very a convenient API

- DB.exec(sql, *params) => runs sql returns row count
- DB.query(sql, *params) => runs sql returns usable objects (not a hash)
- DB.query_hash(sql, *params) => runs sql returns an array of hashes
- DB.query_single(sql, *params) => runs sql and returns a flat one dimensional array
- DB.build(sql) => returns a sql builder

See more at: https://github.com/discourse/mini_sql
2018-06-19 16:13:36 +10:00
Guo Xiang Tan 81b5d61fa7 FIX: `topic_destroyed` web hook couldn't find topic. 2018-05-28 17:38:02 +08:00
Régis Hanol c5c1d8e180 Add support for the '/p/:post_id' route on the client-side 2018-03-24 02:44:39 +01:00
Arpit Jalan 345b453ee1 optimize query for fetching PM created in previous hour 2018-03-12 16:40:17 +05:30
Arpit Jalan 3a35f459c7 optimize last pm log fetching 2018-03-11 09:34:08 +05:30
Arpit Jalan f862122978 FIX: do not log personal message view if there exists a similar log in previous hour 2018-03-11 09:23:32 +05:30
Arpit Jalan b9a669ba32 FIX: do not log personal message view if user can't see the message 2018-02-25 22:39:25 +05:30
Arpit Jalan 1f6adbea5c FEATURE: log private message views 2018-01-29 08:08:08 +05:30
Sam dee498a281 correct regression 2017-12-13 17:36:36 +11:00
Sam 9d925f6b26 FIX: correctly count participants when more than 24
Also cuts out one query for the normal case
2017-12-13 17:19:42 +11:00
Gerhard Schlager 44ee388070 FEATURE: omit images from og and twitter description tags 2017-11-28 21:34:02 +01:00
Régis Hanol 47e79570cc FIX: frequent posters wasn't displaying the correct information 2017-10-02 17:47:04 +02:00
Robin Ward 00b190af75 Revert "A safe way to create class variables in a multisite environment."
The approach taken by this interface was flawed. We need a better
solution.
2017-09-29 11:06:12 -04:00
Robin Ward 3e13becf33 A safe way to create class variables in a multisite environment.
This should allow plugins to set class variables that will not
stomp on other plugins.
2017-09-27 13:00:47 -04:00
Guo Xiang Tan 5be5def217 PERF: Bypass AR and just use raw SQL. 2017-09-25 13:48:59 +08:00
Régis Hanol 797936d2c5 FIX: don't leak whisper count in user card 2017-09-14 20:08:16 +02:00
Régis Hanol 0096ee40da FIX: only show participants the user can see 2017-09-13 17:14:03 +02:00
Guo Xiang Tan 58321d0783 PERF: Remove `Object#present?` check introduced in e0d5d9670a. 2017-09-07 21:36:27 +08:00
Guo Xiang Tan e0d5d9670a Fix the build. 2017-09-07 18:41:44 +08:00
Guo Xiang Tan 3e123b1a39 PERF: Use `pluck` instead of enmurating through all the records. 2017-09-07 17:24:23 +08:00
Régis Hanol 75e4f7f896 Shorten some very long lines
Prevent warnings from already defined constants when reloading
2017-08-12 04:18:04 +02:00
Régis Hanol ecbeaed0bc fix weird indentation 2017-08-04 17:28:25 +02:00
Régis Hanol c76161787c eager load more tables for the topic_view 2017-08-04 17:23:53 +02:00
Guo Xiang Tan 5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Sam 6ddd8d9166 FIX: when entering topics "tracking" would not be set
There was a timing issue when subscribing to messages for topics.

Old flow:

- We generate JSON for topic
- We subscribe to messages for topic

New flow:

- We keep track of last id in the topic message bus channel
- We generate JSON
- We subscribe to messages for topic starting at saved message id

This ensures that there is complete overlap for message consumption
and that there are no cases where an update may go missing due to timing
2017-05-16 15:04:21 -04:00
Neil Lalonde 5a8bbe663a FEATURE: include most popular tag in page title for webcrawlers of tagged uncategorized topics 2017-02-07 16:55:42 -05:00
Neil Lalonde 61d4c1203e FEATURE: group avatar flair shows on topic participants list, and participant avatars can have custom styles 2017-01-18 11:38:00 -05:00
Arpit Jalan 988aca6d92 FIX: bump opengraph user avatar image to 200px 2016-11-26 23:00:18 +05:30