mirror of
https://gitea.invidious.io/iv-org/invidious.git
synced 2024-08-15 00:53:41 +00:00
SigHelper: Fix some logic errors raised during code review
This commit is contained in:
parent
7798faf234
commit
cc36a82933
2 changed files with 5 additions and 5 deletions
|
@ -144,7 +144,7 @@ module Invidious::SigHelper
|
||||||
|
|
||||||
# Return when the player was last updated
|
# Return when the player was last updated
|
||||||
def get_player_timestamp : UInt64?
|
def get_player_timestamp : UInt64?
|
||||||
request = Request.new(Opcode::GET_SIGNATURE_TIMESTAMP, nil)
|
request = Request.new(Opcode::PLAYER_UPDATE_TIMESTAMP, nil)
|
||||||
|
|
||||||
return self.send_request(request) do |bytes|
|
return self.send_request(request) do |bytes|
|
||||||
IO::ByteFormat::NetworkEndian.decode(UInt64, bytes)
|
IO::ByteFormat::NetworkEndian.decode(UInt64, bytes)
|
||||||
|
|
|
@ -15,11 +15,11 @@ class Invidious::DecryptFunction
|
||||||
# If we have updated in the last 5 minutes, do nothing
|
# If we have updated in the last 5 minutes, do nothing
|
||||||
return if (now - @last_update) > 5.minutes
|
return if (now - @last_update) > 5.minutes
|
||||||
|
|
||||||
# Get the time when the player was updated, in the event where
|
# Get the amount of time elapsed since when the player was updated, in the
|
||||||
# multiple invidious processes are run in parallel.
|
# event where multiple invidious processes are run in parallel.
|
||||||
player_time = Time.unix(@client.get_player_timestamp || 0)
|
update_time_elapsed = (@client.get_player_timestamp || 301).seconds
|
||||||
|
|
||||||
if (now - player_time) > 5.minutes
|
if update_time_elapsed > 5.minutes
|
||||||
LOGGER.debug("Signature: Player might be outdated, updating")
|
LOGGER.debug("Signature: Player might be outdated, updating")
|
||||||
@client.force_update
|
@client.force_update
|
||||||
@last_update = Time.utc
|
@last_update = Time.utc
|
||||||
|
|
Loading…
Reference in a new issue