Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve playback statistics #4339

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

syeopite
Copy link
Member

  • Latches previous playback stats object to ensure that Invidious won't ever return an empty object for that endpoint (unless the process has just started)
  • Increment successfulRequests when YouTube returns the correct video in InnerTube

@syeopite syeopite requested a review from a team as a code owner December 16, 2023 22:08
@syeopite syeopite requested review from SamantazFox and removed request for a team December 16, 2023 22:08

This comment was marked as outdated.

@github-actions github-actions bot added the stale label Mar 18, 2024
@syeopite syeopite removed the stale label Apr 1, 2024
@@ -65,6 +71,7 @@ class Invidious::Jobs::StatisticsRefreshJob < Invidious::Jobs::BaseJob
}

# Reset playback requests tracker
LATCHED_PLAYBACK_STATS["playback"] = STATISTICS["playback"].as(Hash(String, Int64 | Float64))
STATISTICS["playback"] = {} of String => Int64 | Float64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just moving this line (the reset) to load_initial_stats and then never touch that element again?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

load_initial_stats is only called once and we need to latch the old playback stats each time the statistics is refreshed.

def begin
load_initial_stats
loop do
refresh_stats
sleep 10.minute
Fiber.yield
end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants