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
db:
user: kemal

View file

@ -15,9 +15,10 @@ end
class Config
YAML.mapping({
pool_size: Int32,
threads: Int32,
db: NamedTuple(
pool_size: Int32,
threads: Int32,
channel_threads: Int32,
db: NamedTuple(
user: String,
password: String,
host: String,

View file

@ -27,7 +27,7 @@ CONFIG = Config.from_yaml(File.read("config/config.yml"))
pool_size = CONFIG.pool_size
threads = CONFIG.threads
channel_threads = 10
channel_threads = CONFIG.channel_threads
Kemal.config.extra_options do |parser|
parser.banner = "Usage: invidious [arguments]"
@ -47,6 +47,14 @@ Kemal.config.extra_options do |parser|
exit
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
Kemal::CLI.new