Merge "Fix cert-mon PriorityQueue regression in python3"
This commit is contained in:
commit
56498d9db7
|
@ -25,15 +25,19 @@ LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
class SubcloudAuditData(object):
|
class SubcloudAuditData(object):
|
||||||
"""Representation of a subcloud under audit.
|
"""Representation of a subcloud under audit.
|
||||||
The 'name' field is used for all comparisons.
|
|
||||||
"""
|
"""
|
||||||
def __init__(self, name, audit_count=0):
|
def __init__(self, name, audit_count=0):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.audit_count = audit_count
|
self.audit_count = audit_count
|
||||||
|
self.timestamp = 0
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.name == other.name
|
return self.name == other.name
|
||||||
|
|
||||||
|
def __lt__(self, other):
|
||||||
|
"""Used in sorting the PriorityQueue"""
|
||||||
|
return self.timestamp < other.timestamp
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return hash(self.name)
|
return hash(self.name)
|
||||||
|
|
||||||
|
@ -81,6 +85,7 @@ class SubcloudAuditPriorityQueue(PriorityQueue):
|
||||||
|
|
||||||
# this PriorityQueue is ordered by the next timestamp:
|
# this PriorityQueue is ordered by the next timestamp:
|
||||||
sc_audit_item.audit_count += 1
|
sc_audit_item.audit_count += 1
|
||||||
|
sc_audit_item.timestamp = timestamp
|
||||||
self.put(
|
self.put(
|
||||||
(timestamp, sc_audit_item)
|
(timestamp, sc_audit_item)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue