Cast playback stats hash type prior to return

This commit is contained in:
syeopite 2023-09-01 12:15:44 -07:00
parent aa5f0a49f1
commit 971c324848
No known key found for this signature in database
GPG Key ID: A73C186DA3955A1A
3 changed files with 3 additions and 3 deletions

View File

@ -223,5 +223,5 @@ def get_playback_statistic
Invidious::Jobs::StatisticsRefreshJob::STATISTICS["playback"] = tracker
end
return tracker
return tracker.as(Hash(String, Int64 | Float64))
end

View File

@ -80,7 +80,7 @@ module Invidious::Routes::VideoPlayback
# Remove the Range header added previously.
headers.delete("Range") if range_header.nil?
playback_statistics = get_playback_statistic().as(Hash(String, Int64 | Float64))
playback_statistics = get_playback_statistic()
playback_statistics["totalRequests"] += 1
if response.status_code >= 400

View File

@ -81,7 +81,7 @@ def extract_video_info(video_id : String, proxy_region : String? = nil)
# Although technically not a call to /videoplayback the fact that YouTube is returning the
# wrong video means that we should count it as a failure.
get_playback_statistic().as(Hash(String, Int64 | Float64))["totalRequests"] += 1
get_playback_statistic()["totalRequests"] += 1
return {
"version" => JSON::Any.new(Video::SCHEMA_VERSION.to_i64),