Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate Bodies Script #9669

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Truncate Bodies Script #9669

wants to merge 12 commits into from

Conversation

timolegros
Copy link
Collaborator

@timolegros timolegros commented Oct 24, 2024

Link to Issue

Closes: #8671

Description of Changes

  • Async migration to truncate bodies in the DB
  • Modified routes to truncate bodies before inserting into the DB

Test Plan

  • (Required) get a fresh DB dump: pnpm dump-db
  • Create a thread with more than 2k characters
  • Execute cd packages/commonwealth
    • pnpm ts-exec scripts/truncate-bodies threads
    • pnpm ts-exec scripts/truncate-bodies comments
    • pnpm ts-exec scripts/truncate-bodies thread-versions
    • pnpm ts-exec scripts/truncate-bodies comment-versions
  • View the thread you created before
  • CRUD new threads with more than 2k characters and check version histories

Deployment Plan

  1. Execute the following after deployment:
NODE_ENV=production node --import=extensionless/register --max_old_space_size=$(./scripts/get-max-old-space-size.sh) --enable-source-maps ./build/scripts/truncate-bodies.js threads

NODE_ENV=production node --import=extensionless/register --max_old_space_size=$(./scripts/get-max-old-space-size.sh) --enable-source-maps ./build/scripts/truncate-bodies.js comments

NODE_ENV=production node --import=extensionless/register --max_old_space_size=$(./scripts/get-max-old-space-size.sh) --enable-source-maps ./build/scripts/truncate-bodies.js thread-versions

NODE_ENV=production node --import=extensionless/register --max_old_space_size=$(./scripts/get-max-old-space-size.sh) --enable-source-maps ./build/scripts/truncate-bodies.js comment-versions

Other Considerations

@timolegros timolegros marked this pull request as ready for review October 25, 2024 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migration to Blob Storage (part 4/4)
1 participant