Skip to content

Commit a446d12

Browse files
author
Aleksandr Denisyuk
committed
Update docs
1 parent 7fb80da commit a446d12

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

docs/index.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ Generator returns a duration time to sleep:
3131

3232
```php
3333
/** @var DurationInterface $duration */
34-
$duration = $generator->generate(attempt: 3);;
34+
$duration = $generator->generate(attempt: 3);
3535

36-
// float(8000)
37-
$duration->asMilliseconds();
36+
$duration->asSeconds(); // float(8)
37+
$duration->asMilliseconds(); // float(8_000)
38+
$duration->asMicroseconds(); // float(8_000_000)
39+
$duration->asNanoseconds(); // float(8_000_000_000)
3840
```
3941

4042
As a result, you can work with such values of time as seconds, milliseconds, microseconds and nanoseconds.
@@ -72,12 +74,13 @@ Pass the duration time to Sleeper as below:
7274
use Orangesoft\BackOff\Generator\Generator;
7375
use Orangesoft\BackOff\Duration\DurationInterface;
7476
use Orangesoft\BackOff\Duration\Seconds;
77+
use Orangesoft\BackOff\Duration\Milliseconds;
7578
use Orangesoft\BackOff\Strategy\ExponentialStrategy;
7679
use Orangesoft\BackOff\Jitter\NullJitter;
7780
use Orangesoft\BackOff\Sleeper\Sleeper;
7881

7982
$generator = new Generator(
80-
baseTime: new Seconds(1),
83+
baseTime: new Milliseconds(1_200),
8184
capTime: new Seconds(60),
8285
strategy: new ExponentialStrategy(multiplier: 2),
8386
jitter: new NullJitter(),
@@ -88,7 +91,7 @@ $sleeper = new Sleeper();
8891
/** @var DurationInterface $duration */
8992
$duration = $generator->generate(attempt: 3);
9093

91-
// time_nanosleep(8, 0)
94+
// time_nanosleep(9, 600000000)
9295
$sleeper->sleep($duration);
9396
```
9497

0 commit comments

Comments
 (0)