Skip to content

Commit 67bb57d

Browse files
committed
add config method to specify the retry periods of the http transport
1 parent 5907c4e commit 67bb57d

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
### Added
4+
5+
- `Innmind\OperatingSystem\Config\Resilient::withHttpRetries()`
6+
37
## 7.0.0 - 2026-02-07
48

59
### Added

src/Config/Resilient.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,21 @@
55

66
use Innmind\OperatingSystem\Config;
77
use Innmind\HttpTransport\Transport;
8+
use Innmind\Time\Period;
9+
use Innmind\Immutable\Sequence;
810

911
/**
1012
* @psalm-immutable
1113
*/
12-
enum Resilient
14+
final class Resilient
1315
{
14-
case instance;
16+
/**
17+
* @param ?Sequence<Period> $retries
18+
*/
19+
private function __construct(
20+
private ?Sequence $retries,
21+
) {
22+
}
1523

1624
#[\NoDiscard]
1725
public function __invoke(Config $config): Config
@@ -31,6 +39,15 @@ public function __invoke(Config $config): Config
3139
#[\NoDiscard]
3240
public static function new(): self
3341
{
34-
return self::instance;
42+
return new self(null);
43+
}
44+
45+
/**
46+
* @param Sequence<Period> $retries
47+
*/
48+
#[\NoDiscard]
49+
public function withHttpRetries(Sequence $retries): self
50+
{
51+
return new self($retries);
3552
}
3653
}

0 commit comments

Comments
 (0)