Allow channel_threads to be configured and increase pool_size

This commit is contained in:
Omar Roth 2018-04-09 22:07:09 -05:00
parent e8349ae46b
commit b3e84e27f8
3 changed files with 15 additions and 5 deletions

View File

@ -1,4 +1,5 @@
pool_size: 10 pool_size: 20
channel_threads: 5
threads: 5 threads: 5
db: db:
user: kemal user: kemal

View File

@ -17,6 +17,7 @@ class Config
YAML.mapping({ YAML.mapping({
pool_size: Int32, pool_size: Int32,
threads: Int32, threads: Int32,
channel_threads: Int32,
db: NamedTuple( db: NamedTuple(
user: String, user: String,
password: String, password: String,

View File

@ -27,7 +27,7 @@ CONFIG = Config.from_yaml(File.read("config/config.yml"))
pool_size = CONFIG.pool_size pool_size = CONFIG.pool_size
threads = CONFIG.threads threads = CONFIG.threads
channel_threads = 10 channel_threads = CONFIG.channel_threads
Kemal.config.extra_options do |parser| Kemal.config.extra_options do |parser|
parser.banner = "Usage: invidious [arguments]" parser.banner = "Usage: invidious [arguments]"
@ -47,6 +47,14 @@ Kemal.config.extra_options do |parser|
exit exit
end end
end end
parser.on("-c THREADS", "--channel-threads=THREADS", "Number of threads for refreshing channels (default: #{channel_threads})") do |number|
begin
channel_threads = number.to_i
rescue ex
puts "THREADS must be integer"
exit
end
end
end end
Kemal::CLI.new Kemal::CLI.new