mirror of
https://github.com/xtr-dev/payload-billing.git
synced 2025-12-13 04:13:24 +00:00
fix: Implement true atomic optimistic locking and enhance type safety
🔒 Critical Race Condition Fixes: - Add version field to payment schema for atomic updates - Implement true optimistic locking using PayloadCMS updateMany with version checks - Eliminate race condition window between conflict check and update - Auto-increment version in beforeChange hooks 🛡️ Type Safety Improvements: - Replace 'any' type with proper ProviderData<T> generic - Maintain type safety throughout payment provider operations - Enhanced intellisense and compile-time error detection ⚡ Performance & Reliability: - Atomic version-based locking prevents lost updates - Proper conflict detection with detailed logging - Graceful handling of concurrent modifications - Version field hidden from admin UI but tracked internally 🔧 Configuration Validation: - All critical validation moved to provider initialization - Early failure detection prevents runtime issues - Clear error messages for configuration problems 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -48,6 +48,7 @@ export interface Payment {
|
||||
| boolean
|
||||
| null;
|
||||
refunds?: (number | Refund)[] | null;
|
||||
version: number;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user