Make OldestAsyncPendingTracker timestamp float
Previously, the OldestAsyncPendingTracker timestamp was stored as a string. This change updates it to be stored as a float. UpgradeImpact: This will require an additional change to the recon parsers in order to process the timestamp as a float. Change-Id: Iba43783e880e0860357ba8b9f0a11f28abf87555
This commit is contained in:
parent
ffbf17e47c
commit
83528de743
@ -233,6 +233,16 @@ class OldestAsyncPendingTracker:
|
|||||||
self.ac_to_timestamp = {}
|
self.ac_to_timestamp = {}
|
||||||
|
|
||||||
def add_update(self, account, container, timestamp):
|
def add_update(self, account, container, timestamp):
|
||||||
|
"""
|
||||||
|
Add or update a timestamp for a given account and container.
|
||||||
|
|
||||||
|
:param account: (str) The account name.
|
||||||
|
:param container: (str) The container name.
|
||||||
|
:param timestamp: (float) The timestamp to add or update.
|
||||||
|
"""
|
||||||
|
# Ensure the timestamp is a float
|
||||||
|
timestamp = float(timestamp)
|
||||||
|
|
||||||
ac = (account, container)
|
ac = (account, container)
|
||||||
|
|
||||||
if ac in self.ac_to_timestamp:
|
if ac in self.ac_to_timestamp:
|
||||||
@ -273,7 +283,7 @@ class OldestAsyncPendingTracker:
|
|||||||
|
|
||||||
def get_oldest_timestamp(self):
|
def get_oldest_timestamp(self):
|
||||||
if self.sorted_entries:
|
if self.sorted_entries:
|
||||||
return float(self.sorted_entries[0][0])
|
return self.sorted_entries[0][0]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_oldest_timestamp_age(self):
|
def get_oldest_timestamp_age(self):
|
||||||
|
@ -403,6 +403,7 @@ class TestObjectUpdaterStats(ReplProbeTest):
|
|||||||
container = entry['container']
|
container = entry['container']
|
||||||
timestamp = entry['timestamp']
|
timestamp = entry['timestamp']
|
||||||
self.assertIsNotNone(timestamp)
|
self.assertIsNotNone(timestamp)
|
||||||
|
self.assertIsInstance(timestamp, float)
|
||||||
ac_set.add((account, container))
|
ac_set.add((account, container))
|
||||||
|
|
||||||
for ac in ac_set:
|
for ac in ac_set:
|
||||||
|
Loading…
Reference in New Issue
Block a user