diff --git a/swift/obj/updater.py b/swift/obj/updater.py index 57752f4e33..8b77001ba4 100644 --- a/swift/obj/updater.py +++ b/swift/obj/updater.py @@ -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): diff --git a/test/probe/test_object_async_update.py b/test/probe/test_object_async_update.py index 1e87c4d4f7..f7276cc25d 100644 --- a/test/probe/test_object_async_update.py +++ b/test/probe/test_object_async_update.py @@ -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: