Project

General

Profile

Actions

Bug #42522

closed

mgr/diskprediction_cloud: refactor timeout() decorator

Added by Willem Jan Withagen over 4 years ago. Updated over 4 years 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 (v1):
Crash signature (v2):

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.

Actions #1

Updated by Willem Jan Withagen over 4 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF