File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -320,6 +320,11 @@ processes by reserving unused tokens.
320
320
$limit->wait();
321
321
} while (!$limit->isAccepted());
322
322
8000
323
+ .. versionadded :: 6.4
324
+
325
+ The support for the ``reserve() `` method for the ``SlidingWindow `` strategy
326
+ was introduced in Symfony 6.4.
327
+
323
328
Exposing the Rate Limiter Status
324
329
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
325
330
@@ -348,7 +353,7 @@ the :class:`Symfony\\Component\\RateLimiter\\Reservation` object returned by the
348
353
$limit = $limiter->consume();
349
354
$headers = [
350
355
'X-RateLimit-Remaining' => $limit->getRemainingTokens(),
351
- 'X-RateLimit-Retry-After' => $limit->getRetryAfter()->getTimestamp( ),
356
+ 'X-RateLimit-Retry-After' => $limit->calculateTimeForTokens(1, 1 ),
352
357
'X-RateLimit-Limit' => $limit->getLimit(),
353
358
];
354
359
@@ -365,6 +370,13 @@ the :class:`Symfony\\Component\\RateLimiter\\Reservation` object returned by the
365
370
}
366
371
}
367
372
373
+ .. versionadded :: 6.4
374
+
375
+ The :method: `Symfony\\ Component\\ RateLimiter\\ Policy\\ SlidingWindow::calculateTimeForTokens `
376
+ method was introduced in Symfony 6.4. Prior to this, the now deprecated
377
+ :method: `Symfony\\ Component\\ RateLimiter\\ Policy\\ SlidingWindow::getRetryAfter `
378
+ method must be used.
379
+
368
380
.. _rate-limiter-storage :
369
381
370
382
Storing Rate Limiter State
You can’t perform that action at this time.
0 commit comments