diff options
Diffstat (limited to 'azurelinuxagent/common/errorstate.py')
-rw-r--r-- | azurelinuxagent/common/errorstate.py | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/azurelinuxagent/common/errorstate.py b/azurelinuxagent/common/errorstate.py deleted file mode 100644 index 750aa77..0000000 --- a/azurelinuxagent/common/errorstate.py +++ /dev/null @@ -1,31 +0,0 @@ -from datetime import datetime, timedelta - -ERROR_STATE_DELTA = timedelta(minutes=15) - - -class ErrorState(object): - def __init__(self, min_timedelta = ERROR_STATE_DELTA): - self.min_timedelta = min_timedelta - - self.count = 0 - self.timestamp = None - - def incr(self): - if self.count == 0: - self.timestamp = datetime.utcnow() - - self.count += 1 - - def reset(self): - self.count = 0 - self.timestamp = None - - def is_triggered(self): - if self.timestamp is None: - return False - - delta = datetime.utcnow() - self.timestamp - if delta >= self.min_timedelta: - return True - - return False |