loopingcall.RetryDecorator doesn't drop _retry_count on successful invocation of a decorated method
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oslo.service |
Confirmed
|
High
|
Unassigned |
Bug Description
I'm not sure if this is a bug or it's made by design.
The semantics of loopingcall.
To illustrate it:
@loopingcall.
def my_method():
....
raises MyExceptionClass # once in a while
....
For example, I called my_method once but it was retried by the decorator 90 times because it was raising MyExceptionClass instance 90 times. If I call my_method again then, effectively, max retry count will be 10 because it will be use the same internal _retry_count counter as the previous time.
Seems like, RetryDecorator should drop _retry_count when a decorated method is invoked successfully.
If it's a bug then there's one more consequence: it's not thread-safe. If we're calling a decorated method from many parallel threads they'll be sharing the counter field.