From fd6a4ba41c2c1235728a50e1afdbbbee0d1d392f Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 8 Oct 2022 15:25:58 -0400 Subject: [PATCH] Fix update timestamp work item firing too frequently A reconfiguration would schedule a new work item without cancelling the old one, resulting in the timestamp updating multiple times in quick succession (noticeable for statuses <60s old). --- Tusker/Views/Status/TimelineStatusCollectionViewCell.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift b/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift index 9e46d1bb..d9e232d7 100644 --- a/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift +++ b/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift @@ -410,6 +410,9 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti } private func doUpdateTimestamp(status: StatusMO) { + // if there's a pending update timestamp work item, cancel it + updateTimestampWorkItem?.cancel() + timestampLabel.text = status.createdAt.timeAgoString() let delay: DispatchTimeInterval?