Actions
Bug #42522
closedmgr/diskprediction_cloud: refactor timeout() decorator
% Done:
0%
Source:
Tags:
Backport:
nautilus
Regression:
No
Severity:
3 - minor
Reviewed:
Description
timeout() is never passed any parameter when being called, so let's
remove the parameters list of "seconds" and "error_message"
use getattr() instead of hasattr() for retrieving the
member variable of self
pass self to wrapper function explicitly.
return func() right away.
hardwire the error message of TimeoutError to "Timer expired",
because
as neither errno.ETIME nor errno.ETIMEOUT is portable
the only caller of TimeoutError is timeout(), so there is
no need to have the flexibility to pass a different error message
use wraps() as a decorator, simpler this way.
Updated by Willem Jan Withagen over 4 years ago
- Status changed from New to Closed
Actions