Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry 中重试计数器错误地从零开始 #4

Open
2018-11-27 opened this issue Jul 16, 2024 · 1 comment
Open

Retry 中重试计数器错误地从零开始 #4

2018-11-27 opened this issue Jul 16, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@2018-11-27
Copy link
Member

示例代码:

from exceptionx import Retry

@Retry(count=3, sleep=1)
def func():
    int('a')

func()

输出如下:

[2024-07-16 16:37:08] [try:0/3:1] [__main__.func.line6.ValueError] invalid literal for int() with base 10: 'a'
[2024-07-16 16:37:09] [try:1/3:1] [__main__.func.line6.ValueError] invalid literal for int() with base 10: 'a'
[2024-07-16 16:37:10] [try:2/3:1] [__main__.func.line6.ValueError] invalid literal for int() with base 10: 'a'
Traceback (most recent call last):
  ...
@2018-11-27 2018-11-27 added the bug Something isn't working label Jul 16, 2024
@2018-11-27 2018-11-27 self-assigned this Jul 16, 2024
2018-11-27 added a commit to 2018-11-27/exceptionx that referenced this issue Jul 22, 2024
1.`TryExcept` and `TryContext` now support handling exceptions based on exception message strings and have added the functionality to negate exception types.
2.Both `@Retry` and `@Retry()` are now supported as valid syntax, as well as `TryExcept`.
3.Fixed an issue: The retry counter in `Retry` incorrectly started from zero. gqylpy#4
4.Fixed an issue: The `stacklevel` positioning of the logger object was sometimes inaccurate. gqylpy#5
5.Optimized exception output for `Retry`, adding display for `limit_time` and `event`.
6.Fixed a serious issue in `Retry` where exception information might be "spammed" output.
7.Added type checking for the parameter `etype`.
8.The internal default value for retry events has been changed to `None`.
9.Updated annotations, comments, and documentation files for the above changes.

1.`TryExcept` 和 `TryContext` 现在支持按异常消息字符串处理异常,并新增了异常类型取反的功能。
2.同时支持 `@Retry` 和 `@Retry()` 作为有效语法,亦 `TryExcept`。
3.修复问题:`Retry` 中重试计数器错误地从零开始。 gqylpy#4
4.修复问题:日志记录器对象 `stacklevel` 定位有时不准确。 gqylpy#5
5.优化了 `Retry` 的异常输出,增加了对 `limit_time` 和 `event` 显示。
6.修复了 `Retry` 中可能会 “疯狂输出” 异常信息的严重问题。
7.添加对参数 `etype` 的类型校验。
8.重试事件的内部默认值修改为 `None`。
9.针对以上改动更新注解,注释及自述文件。
@2018-11-27 2018-11-27 mentioned this issue Jul 22, 2024
Merged
@2018-11-27
Copy link
Member Author

已修复 #6,版本 4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant