Commit Graph

25 Commits

Author SHA1 Message Date
Ben Visness 3a93aa93e9 Seed users (and rework a lot of user access to use new helpers) 2022-05-07 13:58:00 -05:00
Ben Visness a147cfa325 Rework DB API
This takes advantage of generics, and generally clears up a lot of
inconsistencies and quality-of-life issues.

Start of db rework: clean up, start generics, improve tests

Write some nice aspirational package docs

Rework and document the db API

Tests still pass, at least...now for everything else

Update all callsites of db functions

Finish converting all callsites

Not too bad actually! Centralizing access into the helpers makes a big
difference.

wtf it works
2022-05-06 16:56:13 -05:00
Asaf Gartner f4f439489d Assets for user avatars 2021-12-29 16:38:23 +02:00
Asaf Gartner b5eb718615 Query automatically does ToSlice. Use QueryIterator if you need an
iterator.
2021-12-15 03:36:37 +02:00
Asaf Gartner 950e84d53a Personal project creation 2021-12-02 12:53:36 +02:00
Ben Visness a4ad2c5f04 Update data model for personal projects
Also:
- Added a helper for fetching posts with appropriate visibility
- Added personal projects to the project index
2021-11-06 15:25:31 -05:00
Ben Visness 623aaec9d8 Ensure that that one goroutine exits when the iterator is closed
This resolves that completely nonsensical memory leak situation. As far
as we can understand, the cause was a hodgepodge of the following:

- There is some buffer sharing going on deep in pgx
- Queries made with a cancellable but long-running context (like that
used for background jobs) would leave iterator-related goroutines
hanging
- These goroutines had a pgx `rows` object in their closures, preventing
the row stuff from being garbage collected
- If you look at a profile, it all appears to be caused by whatever
functions were doing the most database queries / reading the most from
Postgres. In fact those things were _allocating_ the most but not
retaining any of that data - it was being retained by these other
goroutines because of magic buffer sharing huzzah I love it

We could have solved this in approximately 30 minutes if Go could
actually tell us what is keeping things alive in the heap, instead of
just tracking allocations.
2021-10-21 01:42:34 -05:00
Ben Visness 986a42c1ac Switch to centralized helpers for fetching threads/posts
This includes the ability to "shadowban" new users who have not yet been
approved. We do not have UI for approving these users.

Migrate deserving users to new Approved status

Add post fetching helpers as well

The logic in the thread/post stuff is definitely getting redundant, but
I'm not sure I'm yet ready to try to abstract any of it away.

The next thing to do is probably to update blogs and other places that
fetch threads/posts, and delete the old helpers.

Move forums and blogs fully to new helpers

Use the helpers on the landing page too

that was easy!

Fix up some spots I missed

Check user status and use helpers on the profile page
2021-09-22 23:48:31 -05:00
Ben Visness d5d3341c81 Improve OpenGraph / favicons 2021-09-08 21:51:43 -05:00
Ben Visness 16ae2188d1 Add background features to the Discord bot 2021-08-26 22:59:12 -05:00
Ben Visness 76f9256e97 Save Discord messages and attachments 2021-08-21 11:15:27 -05:00
Ben Visness 8ecb4a7173 Rework the category/thread data model
Threads can stand alone now. Threads can be attached to resources
directly without requiring a category. In addition, a lot of wiki stuff
and library discussion stuff was deleted because we're not gonna port
it.
2021-07-29 22:49:24 -05:00
Ben Visness 94457aeb93 Close db iterators when context is cancelled 2021-07-23 11:33:53 -05:00
Ben Visness 7f3c818a8f Add forum post deletion 2021-07-21 23:42:34 -05:00
Asaf Gartner a4671c5fb5 Profile page and timeline items 2021-06-22 12:50:40 +03:00
Ben Visness 5f763d334c Start forum category index; fix reflection bugs 2021-05-03 09:51:07 -05:00
Ben Visness e7ff342842 Get the feed largely complete 2021-04-25 14:33:48 -05:00
Ben Visness 292c400dfb Fix up landing page colors 2021-04-23 23:27:45 -05:00
Ben Visness d7c512f1c8 Make progress on the landing page 2021-04-22 18:02:50 -05:00
Ben Visness cbe4b71869 Some kind of arbitrary checkpoint
I am in the middle of:
- porting the landing page
- making some db changes to help with that
- deleting the member and memberextended tables

Mainly the last one. Doing so requires us to update all the other tables
that currently point at member and memberextended so that the foreign
keys will point directly to users. The big thing that we still have yet
to do is links, and actually copying data from the member and
memberextended tables to users.
2021-04-14 20:17:05 -05:00
Ben Visness 8929a5d749 Start porting landing page; rework db layer a bit 2021-03-30 22:55:19 -05:00
Ben Visness 56cd737203 Add initial auth token / login stuff 2021-03-25 22:33:00 -05:00
Ben Visness acca4fe232 Initial implementation of password-checking 2021-03-21 22:07:18 -05:00
Ben Visness 4fb161b3c6 Rework DB query stuff, use for projects 2021-03-21 15:38:37 -05:00
Ben Visness 45763de9e6 Put Go stuff in the /src folder 2021-03-10 21:39:24 -06:00