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).
This commit is contained in:
Shadowfacts 2022-10-08 15:25:58 -04:00
parent 3ab82b2dbb
commit fd6a4ba41c
1 changed files with 3 additions and 0 deletions

View File

@ -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?