## Sentry - Issue: PHP-LARAVEL-1V - URL: https://whisper-money.sentry.io/issues/PHP-LARAVEL-1V ## Root cause `ExchangeRateService::getRates()` skipped the database lookup after `preloadRates()` marked a miss, then used `create()` to cache fetched rates. If another request inserted the same `base_currency` + `date` meanwhile, the unique index threw a duplicate-key exception. ## Fix Use atomic Eloquent `upsert()` for exchange-rate cache writes so concurrent requests converge on one row. Added regression coverage for the preload-miss race path. ## Verification - `php artisan test --compact tests/Feature/ExchangeRateServiceTest.php` - `vendor/bin/pint --dirty --format agent` - `php artisan test --compact --filter="getRates tolerates another request storing rates after preload miss"` |
||
|---|---|---|
| .. | ||
| Actions | ||
| Console/Commands | ||
| Contracts | ||
| Enums | ||
| Events | ||
| Exceptions/Banking | ||
| Http | ||
| Jobs | ||
| Listeners | ||
| Models | ||
| Notifications | ||
| Policies | ||
| Providers | ||
| Services | ||