agoda-com / agoda-com/net-loadbalancing

Add resource parameter to `OnError` error handler

Offen
#41 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
C#
Sterne
25
Forks
16
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

# Feature request

## Type

- [ ] - Enhancement - completely new feature
- [x] - Improvement - make what we have better

## Is your feature request related to a problem?

Currently it is not possible to include information about the resource when logging errors in an `OnError` error handler of `ResourceManager.ExecuteAction`, because it only gets the `exception` and the `attemptCount`.

```c#
public delegate void OnError(Exception error, int attemptCount);
```

## Describe the solution you'd like

An extra `resource` parameter in `OnError`.
Example:
```c#
_resourceManager.ExecuteAction(
(serverOptions, _) => doSomething(serverOptions),
(attemptCount, _) => attemptCount <= 3,
(exception, attemptCount, serverOptions ) => _logger.LogError(
exception,
"Failed to connect to server {Host}:{Port}: {Message}",
serverOptions .Host, serverOptions .Port, exception.Message
)
);
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.