feat(plan): simplify structure

This commit is contained in:
2025-05-27 12:56:12 +00:00
parent c3b14c0f58
commit af408d38c9
3 changed files with 30 additions and 286 deletions

View File

@ -423,4 +423,33 @@ tap.start();
- **Connection Reuse**: Don't expect reuse to always be faster than fresh connections
- **Pooled Clients**: Remove usage - tests expect direct client behavior
- **Port Conflicts**: Use different ports for each test to avoid conflicts
- **Resource Cleanup**: Simplified tests that were too complex and timing-dependent
- **Resource Cleanup**: Simplified tests that were too complex and timing-dependent
## Email Architecture Analysis (2025-05-27)
### Current Architecture Issues
1. **Scattered Components**: Email functionality spread across multiple DcRouter properties
- `domainRouter`, `unifiedEmailServer`, `deliveryQueue`, `deliverySystem`, `rateLimiter`
2. **Duplicate SMTP Implementations**:
- EmailSendJob implements raw socket SMTP protocol
- SmtpClient module exists but isn't used for outbound delivery
3. **Complex Setup**: setupUnifiedEmailHandling() is 150+ lines
4. **No Connection Pooling**: Each outbound email creates new connection
5. **Orphaned Code**: SmtpPortConfig class exists but is never used
### Email Traffic Flow
```
External Port → SmartProxy → Internal Port → UnifiedEmailServer → Processing
25 ↓ 10025 ↓ ↓
587 Routes 10587 DomainRouter DeliverySystem
465 10465 ↓
Queue → SmtpClient*
(*should be used)
```
### Planned Refactoring
- Consolidate all email components under UnifiedEmailServer
- Use single SmtpClient instance for all outbound mail
- Simplify DcRouter to just manage high-level services
- Add connection pooling for better performance
- See readme.plan.md for detailed implementation plan