Merge "Make OldestAsyncPendingTracker timestamp float"

This commit is contained in:
Zuul 2024-12-09 23:05:20 +00:00 committed by Gerrit Code Review
commit f9a3f142ab
2 changed files with 12 additions and 1 deletions

View File

@ -233,6 +233,16 @@ class OldestAsyncPendingTracker:
self.ac_to_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)
if ac in self.ac_to_timestamp:
@ -273,7 +283,7 @@ class OldestAsyncPendingTracker:
def get_oldest_timestamp(self):
if self.sorted_entries:
return float(self.sorted_entries[0][0])
return self.sorted_entries[0][0]
return None
def get_oldest_timestamp_age(self):

View File

@ -403,6 +403,7 @@ class TestObjectUpdaterStats(ReplProbeTest):
container = entry['container']
timestamp = entry['timestamp']
self.assertIsNotNone(timestamp)
self.assertIsInstance(timestamp, float)
ac_set.add((account, container))
for ac in ac_set: