mirror of https://github.com/Chocobozzz/PeerTube
Prevent invalid watch sections
parent
0f7195fa40
commit
a49407524f
|
@ -104,7 +104,12 @@ export class VideoViewerStats {
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const lastSection = stats.watchSections[stats.watchSections.length - 1]
|
const lastSection = stats.watchSections[stats.watchSections.length - 1]
|
||||||
lastSection.end = currentTime
|
|
||||||
|
if (lastSection.start > currentTime) {
|
||||||
|
logger.warn('Invalid end watch section %d. Last start record was at %d.', currentTime, lastSection.start)
|
||||||
|
} else {
|
||||||
|
lastSection.end = currentTime
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stats.watchTime = this.buildWatchTimeFromSections(stats.watchSections)
|
stats.watchTime = this.buildWatchTimeFromSections(stats.watchSections)
|
||||||
|
|
Loading…
Reference in New Issue