Commit Graph

159 Commits

Author SHA1 Message Date
Sam 94b8ba4f8f FIX: remove slow platform detection from server side
Historically due to https://meta.discourse.org/t/why-is-discourse-so-slow-on-android/8823
we decreased page sizes of both home page and topic page on android by half.

This was done on the server side and as a side effect and caused page sizes on android
to mismatch between Android and non Android.

Unfortunately about a year ago googlebot started pretending it is Android,
this cause Google to start indexing pages as what android would see. So
it saw double the amount of pages in the index as what exists on desktop.
This in turn caused double the amount of indexing work and a large amount
of broken links on long topics.

This fix removes all special behavior which is no longer needed due to
other performance work in Discourse including raw handlebars on home page
and virtual dom on topic pages.

I tested we do not need this on Blu Advance 5.0 it has 1.3 GHZ mediatec mt6580
This phone retails for around $50 USD.

If we decide long term that we want any hacks like this we will shift them
to the client side. It can just hold data in memory without rendering.
2018-12-13 13:57:05 +11:00
Sam 966d3c8437 remove unneeded code
```
irb(main):001:0> def test; if false; puts "hi"; end; end
=> :test
irb(main):002:0> test
=> nil

```
2018-11-21 12:57:34 +11:00
Sam 20268385a5 FIX: never attempt to log invalid post numbers
Previously in some cases we would queue logging of invalid post numbers

The impact would be we would miss logging an incoming link and would leak
an error.
2018-11-21 11:58:47 +11:00
Sam e17a13ce19 FEATURE: additional "related messages" section
This splits out previous message correspondence from suggeted and instead
has a dedicated section called "related messages"
2018-11-12 13:04:42 +11:00
Neil Lalonde ebe7835316 FIX: links in rss feeds are sometimes wrong on subfolder installs 2018-08-27 18:05:15 -04:00
Arpit Jalan 17b851cf08 FEATURE: show last updated date for wiki topics 2018-07-30 20:27:49 +05:30
Arpit Jalan dfcb2a0d42 FEATURE: include published_time in metadata 2018-07-30 17:09:56 +05:30
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