mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
add config to decrypt on demand instead of polling
This commit is contained in:
parent
28dac81a90
commit
3a2bd4e928
5 changed files with 74 additions and 51 deletions
|
@ -1,15 +1,15 @@
|
|||
class Invidious::Jobs::UpdateDecryptFunctionJob < Invidious::Jobs::BaseJob
|
||||
DECRYPT_FUNCTION = [] of {SigProc, Int32}
|
||||
private getter logger : Invidious::LogHandler
|
||||
|
||||
def initialize(@logger)
|
||||
end
|
||||
|
||||
def begin
|
||||
loop do
|
||||
begin
|
||||
decrypt_function = fetch_decrypt_function
|
||||
DECRYPT_FUNCTION.clear
|
||||
decrypt_function.each { |df| DECRYPT_FUNCTION << df }
|
||||
DECRYPT_FUNCTION.update_decrypt_function
|
||||
rescue ex
|
||||
# TODO: Log error
|
||||
next
|
||||
logger.error("UpdateDecryptFunctionJob : #{ex.message}")
|
||||
ensure
|
||||
sleep 1.minute
|
||||
Fiber.yield
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue