Skip to content

Commit 81d8c9d

Browse files
authored
Merge pull request #1013 from devmasalati/feat/852-853-854-855
fixed issue
2 parents 8732bad + ce36a8e commit 81d8c9d

29 files changed

Lines changed: 5090 additions & 290 deletions
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
"clipsproject": minor
3+
---
4+
5+
Implement Redis-based session sharing across serverless instances
6+
7+
- Add Redis client manager with connection pooling and health monitoring
8+
- Implement automatic fallback to in-memory storage when Redis is unavailable
9+
- Add health check endpoint at `/api/health/redis` for monitoring
10+
- Configure connection pool with retry logic and automatic reconnection
11+
- Add comprehensive error handling and logging throughout Redis operations
12+
- Document Redis configuration and deployment for serverless environments
13+
14+
**New Features:**
15+
- Redis connection pooling for optimal performance
16+
- Automatic health checks every 30 seconds
17+
- Graceful fallback to in-memory storage
18+
- Reconnection with exponential backoff
19+
- Pool metrics and connection statistics
20+
21+
**New Environment Variables:**
22+
- `REDIS_MAX_RETRIES` - Max command retries (default: 3)
23+
- `REDIS_RETRY_DELAY` - Delay between retries in ms (default: 1000)
24+
- `REDIS_CONNECT_TIMEOUT` - Connection timeout in ms (default: 10000)
25+
- `REDIS_COMMAND_TIMEOUT` - Command timeout in ms (default: 5000)
26+
- `REDIS_KEEP_ALIVE` - TCP keep-alive interval in ms (default: 30000)
27+
- `REDIS_MAX_RECONNECT_ATTEMPTS` - Max reconnection attempts (default: 10)
28+
- `REDIS_HEALTH_CHECK_INTERVAL` - Health check interval in ms (default: 30000)
29+
30+
**Breaking Changes:**
31+
- None - backward compatible with existing in-memory implementation
32+
33+
**Benefits:**
34+
- Resolves state inconsistency across serverless instances
35+
- Improves job state reliability in distributed environments
36+
- Enables proper SSE stream updates across all instances
37+
- Production-ready with automatic failover capabilities
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
"clipsproject": minor
3+
---
4+
5+
Add database connection pooling for Prisma
6+
7+
- Configure Prisma connection pool settings with environment variables
8+
- Add connection pool monitoring and health check endpoint at `/api/health/database`
9+
- Implement connection timeout handling middleware
10+
- Add connection pool metrics to logging (configurable)
11+
- Create load testing script for connection pool validation
12+
- Add comprehensive test coverage for pooling functionality
13+
- Document configuration and best practices in `docs/DATABASE_CONNECTION_POOLING.md`
14+
15+
**New Environment Variables:**
16+
- `DATABASE_POOL_SIZE` - Connection pool size (default: 10)
17+
- `DATABASE_CONNECTION_TIMEOUT` - Query timeout in ms (default: 10000)
18+
- `DATABASE_POOL_IDLE_TIMEOUT` - Idle timeout in ms (default: 30000)
19+
- `DATABASE_LOG_POOL_METRICS` - Enable detailed metrics logging (default: false)
20+
- `DATABASE_SLOW_QUERY_THRESHOLD` - Slow query threshold in ms (default: 1000)
21+
22+
**Breaking Changes:**
23+
- Requires `@prisma/client` and `prisma` packages to be installed
24+
- Run `npm install` to add Prisma dependencies

.env.example

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,30 @@ AWS_SECRET_ACCESS_KEY=
3232

3333
# Redis connection used by the job repository (redis:// or rediss://)
3434
# Example: redis://:password@hostname:6379
35+
# For TLS: rediss://:password@hostname:6380
3536
REDIS_URL=
3637

38+
# Redis connection pooling and retry configuration (optional)
39+
REDIS_MAX_RETRIES=3
40+
REDIS_RETRY_DELAY=1000
41+
REDIS_CONNECT_TIMEOUT=10000
42+
REDIS_COMMAND_TIMEOUT=5000
43+
REDIS_KEEP_ALIVE=30000
44+
REDIS_MAX_RECONNECT_ATTEMPTS=10
45+
REDIS_HEALTH_CHECK_INTERVAL=30000
46+
47+
# Database (PostgreSQL with connection pooling)
48+
# Connection pooling is configured via URL parameters or environment variables
49+
# Example with connection pooling: postgresql://user:pass@localhost:5432/clips?connection_limit=10&pool_timeout=10
50+
DATABASE_URL=postgresql://user:password@localhost:5432/clips
51+
52+
# Connection pool configuration (optional - overrides URL parameters)
53+
DATABASE_POOL_SIZE=10
54+
DATABASE_CONNECTION_TIMEOUT=10000
55+
DATABASE_POOL_IDLE_TIMEOUT=30000
56+
DATABASE_LOG_POOL_METRICS=false
57+
DATABASE_SLOW_QUERY_THRESHOLD=1000
58+
3759
# Optional local dev settings
3860
CI=false
3961
NODE_ENV=development

0 commit comments

Comments
 (0)