Skip to content

Commit 4de5480

Browse files
KyleTryonseer-by-sentry[bot]claude
authored
fix: batch optimization stage 1 (#80)
* Feat: Implement batch processing and optimized article insertion for RSS fetching * perf: increase feed batch size and add queue implementation plan - Increase maxFeedsPerBatch from 20 to 100 for faster rotation - With 1-minute cron frequency, this processes 6,000 feeds/hour - Add comprehensive queue-based architecture plan for Phase 3 - Plan includes runtime abstraction for both Cloudflare and Docker - Supports scaling from 2K to 50K+ feeds with <5min freshness Queue plan features: - Cloudflare Queues for Workers deployment - BullMQ (Redis) for Docker deployment - In-memory fallback for development - Graceful degradation when queue unavailable - Cost projections and migration strategy included 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: format * fix: address Sentry bug and ESLint errors Critical fixes: - Use .limit() server-side instead of loading all feeds into memory This prevents memory pressure (e.g., 25MB for 50K feeds) and scales better - Add separate lightweight query for total count (only fetches IDs) - Fix ESLint error: add proper type assertion for D1 batch statements Technical details: - Changed from allSources.slice() to db.select().limit() - Added comment explaining Drizzle/D1 type mismatch - Formatted queue implementation plan with Prettier Note: Existing type errors with inArray() remain unfixed (pre-existing issue) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: resolve type errors from batch optimization commit The batch optimization commit (913b220) introduced type errors by using .select() with field specifications, which breaks Drizzle ORM's type inference for inArray(). Fixes: - Line 205: Changed .select({ plan }) back to .select() - Line 560: Changed .select({ guid }) back to .select() - Line 92: Changed .select({ id }) back to .select() Root cause: Drizzle's inArray() requires full table selection for proper type inference. Using partial field selection breaks the type chain. Confirmed: main branch has no type errors, errors were introduced in 913b220 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: format * chore: simplify format scripts in monorepo Replace complex multi-package format scripts with single prettier command that formats entire repository in one pass. Before: - format:root for root files - Separate format commands for each package - 4 total script definitions After: - Single `prettier --write .` command - Leverages .prettierignore for exclusions - Simpler, faster, and more maintainable 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: format all files with prettier Run prettier across entire codebase to fix trailing newlines, line wrapping, and formatting inconsistencies. Changes include: - Remove trailing newlines from config files - Fix line wrapping in markdown documentation - Standardize formatting in YAML workflow files - Reformat JSON snapshot files - Apply consistent code formatting across packages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: format --------- Co-authored-by: seer-by-sentry[bot] <157164994+seer-by-sentry[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 32ec3c9 commit 4de5480

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2354
-2254
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ contact_links:
33
- name: Documentation
44
url: https://github.com/TechSquidTV/Tuvix-RSS/tree/main/docs
55
about: Check out the comprehensive documentation
6-
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
name: 'Get Worker Name'
2-
description: 'Extracts worker name from wrangler.toml and optionally appends suffix'
1+
name: "Get Worker Name"
2+
description: "Extracts worker name from wrangler.toml and optionally appends suffix"
33

44
inputs:
55
wrangler-toml-path:
6-
description: 'Path to wrangler.toml file'
6+
description: "Path to wrangler.toml file"
77
required: false
8-
default: 'packages/api/wrangler.toml'
8+
default: "packages/api/wrangler.toml"
99
suffix:
10-
description: 'Optional suffix to append to worker name (e.g., -dev)'
10+
description: "Optional suffix to append to worker name (e.g., -dev)"
1111
required: false
12-
default: ''
12+
default: ""
1313

1414
outputs:
1515
name:
16-
description: 'The worker name'
16+
description: "The worker name"
1717
value: ${{ steps.get-name.outputs.name }}
1818

1919
runs:
20-
using: 'composite'
20+
using: "composite"
2121
steps:
2222
- name: Get worker name
2323
id: get-name
@@ -28,4 +28,3 @@ runs:
2828
echo "name=$WORKER_NAME" >> $GITHUB_OUTPUT
2929
echo "WORKER_NAME=$WORKER_NAME" >> $GITHUB_ENV
3030
echo "Worker name: $WORKER_NAME"
31-

.github/actions/setup/action.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
name: 'Setup Node.js and pnpm'
2-
description: 'Sets up Node.js and pnpm with caching'
1+
name: "Setup Node.js and pnpm"
2+
description: "Sets up Node.js and pnpm with caching"
33

44
inputs:
55
node-version:
6-
description: 'Node.js version'
6+
description: "Node.js version"
77
required: false
8-
default: '20'
8+
default: "20"
99
pnpm-version:
10-
description: 'pnpm version'
10+
description: "pnpm version"
1111
required: false
12-
default: '10.19.0'
12+
default: "10.19.0"
1313

1414
runs:
15-
using: 'composite'
15+
using: "composite"
1616
steps:
1717
- name: Setup pnpm
1818
uses: pnpm/action-setup@v4
@@ -23,9 +23,8 @@ runs:
2323
uses: actions/setup-node@v4
2424
with:
2525
node-version: ${{ inputs.node-version }}
26-
cache: 'pnpm'
26+
cache: "pnpm"
2727

2828
- name: Install dependencies
2929
shell: bash
3030
run: pnpm install --frozen-lockfile
31-

.github/actions/substitute-d1-database-id/action.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
name: 'Create wrangler.toml from example'
2-
description: 'Creates wrangler.toml from wrangler.example.toml and substitutes D1_DATABASE_ID'
1+
name: "Create wrangler.toml from example"
2+
description: "Creates wrangler.toml from wrangler.example.toml and substitutes D1_DATABASE_ID"
33

44
inputs:
55
wrangler-example-path:
6-
description: 'Path to wrangler.example.toml file'
6+
description: "Path to wrangler.example.toml file"
77
required: false
8-
default: 'packages/api/wrangler.example.toml'
8+
default: "packages/api/wrangler.example.toml"
99
wrangler-toml-path:
10-
description: 'Path where wrangler.toml will be created'
10+
description: "Path where wrangler.toml will be created"
1111
required: false
12-
default: 'packages/api/wrangler.toml'
12+
default: "packages/api/wrangler.toml"
1313
d1-database-id:
14-
description: 'D1 Database ID secret'
14+
description: "D1 Database ID secret"
1515
required: true
1616

1717
runs:
18-
using: 'composite'
18+
using: "composite"
1919
steps:
2020
- name: Create wrangler.toml from example
2121
shell: bash

.github/workflows/CI_IMPROVEMENTS.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ This document outlines the improvements made to the CI/CD workflows to make them
99
### 1. DRY (Don't Repeat Yourself) ✅
1010

1111
**Before:**
12+
1213
- Setup steps (checkout, pnpm setup, node setup, install) repeated in every job
1314
- Worker name extraction logic duplicated across deployment workflows
1415
- D1 database ID substitution logic duplicated
1516
- Deployment version extraction duplicated
1617

1718
**After:**
19+
1820
- Created reusable composite actions:
1921
- `.github/actions/setup/` - Centralized Node.js and pnpm setup
2022
- `.github/actions/substitute-d1-database-id/` - Reusable D1 substitution logic
@@ -25,42 +27,51 @@ This document outlines the improvements made to the CI/CD workflows to make them
2527
### 2. Efficiency Improvements ✅
2628

2729
**Parallelization:**
30+
2831
- All CI jobs (lint, format, type-check, test-api, test-app, build) already run in parallel
2932
- Tests run independently and can complete faster than sequential execution
3033

3134
**Caching:**
35+
3236
- pnpm cache is automatically handled by `actions/setup-node@v4` with `cache: 'pnpm'`
3337
- This significantly speeds up dependency installation on subsequent runs
3438

3539
**Reduced Redundancy:**
40+
3641
- CI workflows now use a single reusable workflow instead of duplicating steps
3742
- Deployment workflows share common actions
3843

3944
### 3. Quality Improvements ✅
4045

4146
**Fixed Format Check:**
47+
4248
- **Before:** `format:app` didn't use `--check` flag, so it would modify files instead of failing
4349
- **After:** Added `--check` flag to `format:app` script so CI properly fails on formatting issues
4450

4551
**Removed Test Failure Masking:**
52+
4653
- **Before:** Tests used `|| true` which masked failures
4754
- **After:** Removed `|| true` so test failures properly fail the CI
4855

4956
**Proper Error Handling:**
57+
5058
- Format checks now properly fail when code is not formatted
5159
- Test failures are no longer hidden
5260

5361
### 4. Speed Improvements ✅
5462

5563
**Faster Setup:**
64+
5665
- Reusable actions reduce workflow parsing time
5766
- Cached dependencies speed up installation
5867

5968
**Parallel Execution:**
69+
6070
- All jobs run in parallel (no dependencies between lint, format, type-check, tests)
6171
- Build job runs independently
6272

6373
**Reduced Workflow Size:**
74+
6475
- Smaller workflow files are faster to parse and validate
6576
- Less YAML to process
6677

@@ -95,7 +106,7 @@ jobs:
95106
uses: ./.github/workflows/ci-reusable.yml
96107
with:
97108
upload_coverage: true
98-
upload_artifacts: true # Only for development branch
109+
upload_artifacts: true # Only for development branch
99110
```
100111
101112
### Deployment Workflows
@@ -114,7 +125,7 @@ Deployment workflows now use composite actions:
114125
- name: Get worker name
115126
uses: ./.github/actions/get-worker-name
116127
with:
117-
suffix: '-dev' # Optional
128+
suffix: "-dev" # Optional
118129
```
119130
120131
## Benefits
@@ -148,7 +159,7 @@ To verify the improvements work:
148159
4. Create a release → Should trigger `deploy-cloudflare.yml`
149160

150161
All workflows should:
162+
151163
- Complete faster due to parallelization
152164
- Fail properly on formatting/test issues
153165
- Use the new reusable components
154-

0 commit comments

Comments
 (0)