Commit graph

15640 commits

Author SHA1 Message Date
Ben Rog-Wilhelm
984a613868
Merge pull request #490 from TLSM/pr-fix-comment-perf
Fix comment eager loading
2023-02-07 06:58:35 -06:00
TLSM
43f329badf
Fix Session expiry for tests
This is likely not an issue for production (since each request will
get its own SQLAlchemy session), but `scoped_session` results in the
tests reuseing the same Session across tests. The tests rely on
the default session expiry behavior.
2023-02-07 07:04:02 -05:00
TLSM
509332e9cc
Fix comment eager loading
Following #485, we began investigating post/comment rendering
bottlenecks. The most immediate issue is the eager comment loading
(merged in 23a8fb9663) did not seem fully operative: query logs
showed comments and associated FKs were being lazy loaded again
(linear query quantity in number of rendered comments). In fact,
CPU load seemed even worse than previous lazy loading.

Bisect revealed first bad commit: fb77cbcc2b
which fixed post view counters by committing the SQLAlchemy session
instead of flushing, following upstream's fix. However, committing
a session has the unfortunate side effect of dumping cached session
objects, such as the previously loaded comment objects and their
relationships, causing fallback to the old lazy behavior.

We fix this here by explicitly telling SQLAlchemy to not expire
the session on commit.

Hopefully this will simultaneously resolve the elevated DB CPU load
observed in production and speed up page rendering again.
2023-02-07 06:37:40 -05:00
justcool393
9bf2f76819
deps: freeze SQLAlchemy to [1.4.43, 2.0) (SemVer), python to [3.10, 4.x) 2023-02-07 04:32:06 -06:00
TLSM
175f9c1d22 Cleanup sidebar sizing style kludges
The 15-line <pre> block at the bottom of the sidebar was a fix for
mobile hamburger menu behavior on upstream, where the long mobile
sidebar would be covered by the bottom navigation drawer.

In-place replacement would be `margin-bottom: 15em`, but it's not
actually necessary for the sidebar as used on TheMotte, and it adds
an unsightly block of whitespace to the bottom of the homepage.

Also the `style` attribute width was related to `GET /sidebar`
behavior (sidebar.html), which is unused on TheMotte, having been
replaced in the signup template with a link to `/rules`.
2023-02-04 04:13:18 -06:00
TLSM
7a9a3f7c99 Randomize sidebar recommendation order (#483)
Fixes #483. Implement a Jinja template filter to shuffle a sequence
(which surprisingly doesn't already exist) and shuffle the relevant
lists in the sidebar.
2023-02-04 04:13:18 -06:00
Ben Rog-Wilhelm
50b098f740 Add Femradebates to the link list. 2023-02-04 01:35:09 -06:00
justcool393
9ee7b73929 fix scrolling bug (#279)
ref: f7ca9aa24822d8361fd6fa939c0492711629682b on Aevann1/rDrama
2023-01-25 08:39:46 -06:00
justcool393
38e87e86f8 transfers: remove /transfers/ 2023-01-20 06:02:14 -06:00
justcool393
a022c09005 admin: remove merging
it was kinda borked anyway
2023-01-20 06:01:59 -06:00
justcool393
b6af1fd1f3 giphy: remove giphy 2023-01-20 06:01:34 -06:00
Ben Rog-Wilhelm
fd2b2f9380
Merge pull request #459 from faul-sname/themotte-issue-451
[#451] Add count of collapsed comments in the collapsed comment thingy
2023-01-14 03:15:54 -06:00
faul_sname
c0a546d779 [themotte/rDrama#451] Passing in the db connection as an optional param makes things easier 2023-01-13 19:33:56 -08:00
faul_sname
12ca271fe7 [themotte/rDrama#451] Use bulk_recompute_descendant_counts() in migration 2023-01-13 19:14:40 -08:00
faul_sname
cdac0174f1 [themotte/rDrama#451] Add test for bulk_recompute_descendant_counts() 2023-01-13 19:12:56 -08:00
faul_sname
e14d1b809c [themotte/rDrama#451] Extract the recomputation of descendant counts to its own function 2023-01-13 19:12:16 -08:00
faul_sname
b75c93e600 Merge remote-tracking branch 'origin/frost' into themotte-issue-451 2023-01-12 22:09:07 -08:00
faul_sname
4a6ed37166 [themotte/rDrama#451] Move the pusher_thread() function from files/routes/comment.py to files/helpers/comment.py 2023-01-09 00:07:49 -08:00
justcool393
08f4cd2274 fix: volunteer duties can be None
make sure return type is correct so callees don't get an unexpected `None`
2023-01-09 00:30:20 -06:00
justcool393
712a0ad631 awards: remove tilt award 2023-01-08 19:38:20 -06:00
virtual256
da03335cb5 Replace sql_ilike_clean with func.lower for non-pattern uses; also fixes #398 2023-01-08 19:37:26 -06:00
justcool393
21676622e6 volunteer: fix missing import 2023-01-08 03:17:26 -06:00
justcool393
0ea72e3778
Debug: Add button in admin panel to login to other accounts (#437) 2023-01-08 03:16:02 -06:00
Ben Rog-Wilhelm
ec4eafdbfc Automatically detect the number of release Gunicorn workers. 2023-01-07 18:35:55 -06:00
faul_sname
e94971c7b9 [themotte/rDrama#451] Backfill comments.descendant_count column 2023-01-06 18:28:17 -08:00
faul_sname
779d27706d [themotte/rDrama#451] Add a test for the labels on "More Comments (n)" buttons 2023-01-06 18:27:54 -08:00
faul_sname
434542b586 [themotte/rDrama#451] Show the number of descendants on the "More comments" button 2023-01-06 18:27:23 -08:00
virtual256
e475a66816 Fix: Docker overlay missing version 2023-01-06 20:14:35 -06:00
faul_sname
2e29b468ec [themotte/rDrama#451] Add a test for comment.descendant_count accuracy 2023-01-03 01:45:37 -08:00
faul_sname
8d24fc3a48 [themotte/rDrama#451] Add relation 2023-01-03 01:44:40 -08:00
faul_sname
9c1e247685 [themotte/rDrama#451] Fixture fixes 2023-01-03 01:36:40 -08:00
faul_sname
7d12ddc89e [themotte/rDrama#451] With tests in place, extract out logic for updating the counters 2023-01-03 01:24:20 -08:00
faul_sname
7bfccf36d0 [themotte/rDrama#451] And finally that test can test the comment count correctly 2023-01-03 01:18:15 -08:00
faul_sname
19e9b161d4 [themotte/rDrama#451] When a comment is removed, aggregates (post comment count, author comment count) are updated 2023-01-03 01:17:41 -08:00
faul_sname
f8c27f3620 [themotte/rDrama#451] define comment_on_unpublish() function 2023-01-03 01:17:00 -08:00
faul_sname
2e0104a7cc [themotte/rDrama#451] Expand test coverage to cover who should see removed comments 2023-01-03 01:12:31 -08:00
faul_sname
28f4807a9b [themotte/rDrama#451] Move comment_on_publish() to files/helpers/comments.py 2023-01-03 01:11:50 -08:00
faul_sname
9525396131 [themotte/rDrama#451] DDL: add comments.descendant_count column 2023-01-02 23:58:25 -08:00
faul_sname
d7589716f6 [themotte/rDrama#451] Fix test 2023-01-01 23:06:51 -08:00
faul_sname
e7508dad56 [themotte/rDrama#451] A test 2022-12-31 02:35:37 -08:00
faul_sname
b06a481a0f [themotte/rDrama#451] Ability to disable secure session cookie with env var 2022-12-31 02:18:56 -08:00
faul_sname
8b7e637e6e [themotte/rDrama#451] The basic post/comment test should not fail no matter what env says 2022-12-31 02:07:18 -08:00
faul_sname
6905710b18 [themotte/rDrama#451] Sometimes we also want the user, not just their session 2022-12-31 02:06:42 -08:00
faul_sname
f78345a4fb [themotte/rDrama#451] Decorator when we do not want to rate limit in tests 2022-12-31 02:06:17 -08:00
faul_sname
0dcca12c04 [themotte/rDrama#451] New fixture for comments 2022-12-31 02:05:22 -08:00
faul_sname
4bfb66272c [themotte/rDrama#451] New fixture for submissions 2022-12-31 02:05:02 -08:00
faul_sname
9468e217f0 [themotte/rDrama#451] Allow explicitly setting the scheme to http or https in env 2022-12-30 23:39:46 -08:00
faul_sname
4010a0e752 [themotte/rDrama#451] Remove the import *
Fixes a bug if someone is serving localhost on a port that is not port 80
2022-12-30 20:25:57 -08:00
Ben Rog-Wilhelm
f4c6c7cf91 Fix: Deleted comments show up in the Janitor Volunter system. 2022-12-30 01:44:16 -06:00
Ben Rog-Wilhelm
fe800dd9a5 Add a grandchild comment test. 2022-12-28 09:14:33 -06:00