mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2026-01-01 04:21:16 +00:00
Add playback success rate to /api/v1/stats (#4085)
* Add stats-based /videoplayback blockage status * Count when YouTube returns wrong video as failure * Cast playback stats hash type prior to return * Bump stats refresh timer to 10 minutes
This commit is contained in:
@@ -18,6 +18,13 @@ class Invidious::Jobs::StatisticsRefreshJob < Invidious::Jobs::BaseJob
|
||||
"updatedAt" => Time.utc.to_unix,
|
||||
"lastChannelRefreshedAt" => 0_i64,
|
||||
},
|
||||
|
||||
#
|
||||
# "totalRequests" => 0_i64,
|
||||
# "successfulRequests" => 0_i64
|
||||
# "ratio" => 0_i64
|
||||
#
|
||||
"playback" => {} of String => Int64 | Float64,
|
||||
}
|
||||
|
||||
private getter db : DB::Database
|
||||
@@ -30,7 +37,7 @@ class Invidious::Jobs::StatisticsRefreshJob < Invidious::Jobs::BaseJob
|
||||
|
||||
loop do
|
||||
refresh_stats
|
||||
sleep 1.minute
|
||||
sleep 10.minute
|
||||
Fiber.yield
|
||||
end
|
||||
end
|
||||
@@ -56,5 +63,8 @@ class Invidious::Jobs::StatisticsRefreshJob < Invidious::Jobs::BaseJob
|
||||
"updatedAt" => Time.utc.to_unix,
|
||||
"lastChannelRefreshedAt" => Invidious::Database::Statistics.channel_last_update.try &.to_unix || 0_i64,
|
||||
}
|
||||
|
||||
# Reset playback requests tracker
|
||||
STATISTICS["playback"] = {} of String => Int64 | Float64
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user