Anthony watchman integration #6799

Merged
mayeaux merged 20 commits from anthony-watchman-integration into master 2021-08-10 22:42:50 +02:00
Showing only changes of commit 45c3d3eb3d - Show all commits

View file

@ -114,6 +114,10 @@ async function sendAndResetWatchmanData(){
protocol = 'stb';
}
console.log('time at buffer');
console.log(timeAtBuffer);
console.log(totalDurationInSeconds);
const objectToSend = {
rebuf_count: amountOfBufferEvents,
rebuf_duration: amountOfBufferTimeInMS,
@ -122,9 +126,9 @@ async function sendAndResetWatchmanData(){
duration: durationInSeconds * 1000,
protocol,
jessopb commented 2021-08-09 23:09:01 +02:00 (Migrated from github.com)
Review

This sort of thing, if tested elsewhere should use a constant, make a new file in constants if necessary.

This sort of thing, if tested elsewhere should use a constant, make a new file in constants if necessary.
player: playerPoweredBy,
user_id: userId,
user_id: Number(userId),
position: timeAtBuffer,
rel_position: (timeAtBuffer / totalDurationInSeconds * 1000) * 100,
rel_position: Math.round((timeAtBuffer / (totalDurationInSeconds * 1000)) * 100),
}
await sendWatchmanData(objectToSend);
@ -142,7 +146,7 @@ function stopWatchmanInterval() {
}
function startWatchmanIntervalIfNotRunning() {
if (!watchmanInterval) {
watchmanInterval = setInterval(sendAndResetWatchmanData, 1000 * 30);
watchmanInterval = setInterval(sendAndResetWatchmanData, 1000 * durationInSeconds);
}
}
@ -169,9 +173,9 @@ const analytics: Analytics = {
claimUrl = claim.canonical_url;
playerPoweredBy = data.playerPoweredBy;
timeAtBuffer = claim.timeatBuffer;
timeAtBuffer = data.timeAtBuffer;
totalDurationInSeconds = claim.duration;
totalDurationInSeconds = data.duration;
console.log('RUNNING HERE');