From d732fa2016ab0f01497dc9b271c1d497b0c3b775 Mon Sep 17 00:00:00 2001 From: chrisk325 Date: Sun, 1 Mar 2026 00:53:06 +0530 Subject: [PATCH] fix edge cases where items sync back to trakt with "now" timestamp --- src/services/storageService.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/services/storageService.ts b/src/services/storageService.ts index 74402527a..51d136051 100644 --- a/src/services/storageService.ts +++ b/src/services/storageService.ts @@ -500,7 +500,10 @@ class StorageService { traktProgress: highestTraktProgress, currentTime: highestCurrentTime, }; - await this.setWatchProgress(id, type, updatedProgress, episodeId); + // preserveTimestamp: true prevents lastUpdated from being bumped to Date.now(), + // which would make getUnsyncedProgress() think the entry needs re-syncing and + // re-add already-watched movies/episodes back to Trakt history. + await this.setWatchProgress(id, type, updatedProgress, episodeId, { preserveTimestamp: true }); } } catch (error) { logger.error('Error updating Trakt sync status:', error); @@ -540,7 +543,9 @@ class StorageService { simklProgress: highestSimklProgress, currentTime: highestCurrentTime, }; - await this.setWatchProgress(id, type, updatedProgress, episodeId); + // preserveTimestamp: true prevents lastUpdated from being bumped to Date.now(), + // which would make getUnsyncedProgress() treat synced entries as needing re-sync. + await this.setWatchProgress(id, type, updatedProgress, episodeId, { preserveTimestamp: true }); } } catch (error) { logger.error('Error updating Simkl sync status:', error);