fix: resolve Prettier markdown code block parsing errors

- Fix syntax errors in skills markdown files (.github/skills, .opencode/skills)
- Change typescript to tsx for code blocks with JSX
- Replace ellipsis (...) in array examples with valid syntax
- Separate CSS from TypeScript into distinct code blocks
- Convert JavaScript object examples to valid JSON in docs
- Fix enum definitions with proper comma separation
This commit is contained in:
2026-01-20 21:09:29 +01:00
parent 7932fe7386
commit cd05fc8648
177 changed files with 5042 additions and 5541 deletions

View File

@@ -3,6 +3,7 @@
## Issues Identified
From your logs:
```
Can't reach database server at `ep-tiny-math-a2zsshve-pooler.eu-central-1.aws.neon.tech:5432`
[NODE-CRON] [WARN] missed execution! Possible blocking IO or high CPU
@@ -11,29 +12,33 @@ Can't reach database server at `ep-tiny-math-a2zsshve-pooler.eu-central-1.aws.ne
## Root Causes
1. **Multiple PrismaClient instances** across schedulers
2. **No connection retry logic** for temporary failures
2. **No connection retry logic** for temporary failures
3. **No connection pooling optimization** for Neon
4. **Aggressive scheduler intervals** overwhelming database
## Fixes Applied ✅
### 1. Connection Retry Logic (`lib/database-retry.ts`)
- **Automatic retry** for connection errors
- **Exponential backoff** (1s → 2s → 4s → 10s max)
- **Smart error detection** (only retry connection issues)
- **Configurable retry attempts** (default: 3 retries)
### 2. Enhanced Schedulers
- **Import Processor**: Added retry wrapper around main processing
- **Session Processor**: Added retry wrapper around AI processing
- **Graceful degradation** when database is temporarily unavailable
### 3. Singleton Pattern Enforced
- **All schedulers now use** `import { prisma } from "./prisma.js"`
- **No more separate** `new PrismaClient()` instances
- **Shared connection pool** across all operations
### 4. Neon-Specific Optimizations
- **Connection limit guidance**: 15 connections (below Neon's 20 limit)
- **Extended timeouts**: 30s for cold start handling
- **SSL mode requirements**: `sslmode=require` for Neon
@@ -42,6 +47,7 @@ Can't reach database server at `ep-tiny-math-a2zsshve-pooler.eu-central-1.aws.ne
## Immediate Actions Needed
### 1. Update Environment Variables
```bash
# Add to .env.local
USE_ENHANCED_POOLING=true
@@ -53,6 +59,7 @@ DATABASE_URL="postgresql://user:pass@ep-tiny-math-a2zsshve-pooler.eu-central-1.a
```
### 2. Reduce Scheduler Frequency (Optional)
```bash
# Less aggressive intervals
CSV_IMPORT_INTERVAL="*/30 * * * *" # Every 30 min (was 15)
@@ -61,6 +68,7 @@ SESSION_PROCESSING_INTERVAL="0 */2 * * *" # Every 2 hours (was 1)
```
### 3. Run Configuration Check
```bash
pnpm db:check
```
@@ -71,7 +79,7 @@ pnpm db:check
**Resource Efficiency**: Single shared connection pool
**Neon Optimization**: Proper connection limits and timeouts
**Monitoring**: Health check endpoint for visibility
**Graceful Degradation**: Schedulers won't crash on DB issues
**Graceful Degradation**: Schedulers won't crash on DB issues
## Monitoring
@@ -84,8 +92,8 @@ pnpm db:check
- `lib/database-retry.ts` - New retry utilities
- `lib/importProcessor.ts` - Added retry wrapper
- `lib/processingScheduler.ts` - Added retry wrapper
- `lib/processingScheduler.ts` - Added retry wrapper
- `docs/neon-database-optimization.md` - Neon-specific guide
- `scripts/check-database-config.ts` - Configuration checker
The connection issues should be significantly reduced with these fixes! 🎯
The connection issues should be significantly reduced with these fixes! 🎯