Watch history fix

This commit is contained in:
Brahim Hadriche committed 2026-04-23 15:08:25 -04:00
1 parent 4706d71639
commit d427989576
6 files changed
+21 -34

No files matched your search

@@ -74,7 +74,6 @@ function ExecuteJob() as void
MessagePortUtils.ObserveFieldScopedExSafe(callbackNode, "watchTime", port)
CancellationUtils.ObserveCancellationScoped(cancellation, port)
successiveFailures = 0
lastReportedTime = 0.0
while true
message = wait(60000, port)
if CancellationUtils.IsCancellationEvent(cancellation, message)
@@ -97,27 +96,17 @@ function ExecuteJob() as void
end while
watchTime = message.getData()
' On seek-back, clamp st to not exceed et - I don't know if we really need to
if lastReportedTime > watchTime
lastReportedTime = watchTime - 20
if lastReportedTime < 0
lastReportedTime = 0
end if
end if
success = InnertubeService.AuthMarkVideoWatchTime(lastReportedTime, watchTime, playbackTrackingUrls.videostatsWatchtimeUrl, {
success = InnertubeService.AuthMarkVideoWatchTime(watchTime, playbackTrackingUrls.videostatsWatchtimeUrl, {
accessToken: authToken.token
onBehalfOfUser: authToken.activeIdentifyToken
cpn: cpn
' TODO:P1 if we pass cancellation here, http client will remove scoped
' observer, which is stored on the current node.
' This requires an extra observer node to be independent.
cmt: lastReportedTime
cancellation: invalid
})
if success
successiveFailures = 0
lastReportedTime = watchTime
else
successiveFailures += 1
end if