Update management of channel_refresh_interval

Follow indications:
https://github.com/iv-org/invidious/pull/2915#discussion_r811373503
このコミットが含まれているのは:
Féry Mathieu (Mathius) 2022-02-22 01:35:35 +01:00
コミット fd0ac3a671
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: F9CCC80C18A59037
4個のファイルの変更25行の追加7行の削除

ファイルの表示

@ -317,10 +317,10 @@ channel_threads: 1
##
## Time between two jobs for crawling videos from channels
##
## Accepted values: a valid time interval (hours:min:seconds)
## Default: 00:30:00
## Accepted values: a valid time interval (like 1h30m or 90min)
## Default: 30m
##
channel_refresh_interval: 00:30:00
channel_refresh_interval: 30min
##
## Forcefully dump and re-download the entire list of uploaded

ファイルの表示

@ -25,7 +25,7 @@ services:
INVIDIOUS_CONFIG: |
log_level: Info
channel_threads: 1
channel_refresh_interval: 00:30:00
channel_refresh_interval: 30m
check_tables: true
feed_threads: 1
db:

ファイルの表示

@ -53,6 +53,24 @@ def recode_length_seconds(time : Int32) : String
end
end
def decode_interval(string : String) : Time::Span
rawMinutes = string.try &.to_i32?
if !rawMinutes
hours = /(?<hours>\d+)h/.match(string).try &.["hours"].try &.to_i32
hours ||= 0
minutes = /(?<minutes>\d+)m(?!s)/.match(string).try &.["minutes"].try &.to_i32
minutes ||= 0
time = Time::Span.new(hours: hours, minutes: minutes)
else
time = Time::Span.new(minutes: rawMinutes)
end
return time
end
def decode_time(string)
time = string.try &.to_f?

ファイルの表示

@ -259,15 +259,15 @@ struct Preferences
module TimeSpanConverter
def self.to_yaml(value : Time::Span, yaml : YAML::Nodes::Builder)
return yaml.scalar recode_length_seconds(value.total_seconds.to_i32)
return yaml.scalar value.total_minutes.to_i32
end
def self.from_yaml(ctx : YAML::ParseContext, node : YAML::Nodes::Node) : Time::Span
if node.is_a?(YAML::Nodes::Scalar)
return decode_time_span(node.value)
return decode_interval(node.value)
else
node.raise "Expected scalar, not #{node.class}"
end
end
end
end
end