Project

General

Profile

Bug #42522

mgr/diskprediction_cloud: refactor timeout() decorator

Added by Willem Jan Withagen 4 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
% Done:

0%

Source:
Tags:
Backport:
nautilus
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature:

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.

History

#1 Updated by Willem Jan Withagen 4 months ago

  • Status changed from New to Closed

Also available in: Atom PDF