feat: fix idempotency cache

This commit is contained in:
rinsvent 2026-05-18 08:50:13 +07:00
parent 42433a8cbf
commit 8684a6e19b

View File

@ -24,6 +24,12 @@ class IdempotencyMiddleware
$cacheKey = $this->cacheKey($request, $idempotencyKey);
$lockKey = $this->lockKey($request, $idempotencyKey);
// Проверяем чтобы не выполнять код
$cached = Cache::get($cacheKey);
if (is_array($cached)) {
return $this->replayResponse($cached);
}
$lock = Cache::lock($lockKey, config('slots.idempotency_lock_seconds'));
if (! $lock->get()) {
return $this->waitForCachedResponse($cacheKey) ?? $this->inProgressResponse();