Skip to content

Implement goroutine to delete posts from DB every 2 hours#6

Merged
veekaybee merged 2 commits intomainfrom
run_deletes
Jan 1, 2025
Merged

Implement goroutine to delete posts from DB every 2 hours#6
veekaybee merged 2 commits intomainfrom
run_deletes

Conversation

@veekaybee
Copy link
Owner

What's changing

The gitfeed server currently is currently tiny runs into performance issues at query-time, even after some tuning. We've added DB indexes for performance tuning, but we also need to delete old records to not fill up the server, specifically since the feed is meant to be mostly stateless and temporal.

We implement a goroutine that deletes all except the top 10 posts ordered by time from the DB every 2 hours and remove API routes for deletion until we can implement auth.

… and `db.go`

   - Implemented a scheduled cleaning function `cleanUpDb(pr *db.PostRepository)` to remove old posts every 2 hours. (`ingest.go`)
   - Modified the existing `DeletePosts()` method in `db.go` with better logging
@veekaybee veekaybee merged commit 4d0ae9b into main Jan 1, 2025
@veekaybee veekaybee deleted the run_deletes branch January 1, 2025 23:41
This was referenced Jan 1, 2025
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.

1 participant