agoda-com / agoda-com/net-loadbalancing

Add resource parameter to `OnError` error handler

未关闭
#41 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
C#
星标
25
派生
16
PR 合并指标
30 天内没有已合并 PR

描述

# 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
)
);
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。