feat(worker): allow number of threads to be configured

This allows for more threads to be run. Care needs to be taken to ensure that database connection pool size is appropriate for this.
This commit is contained in:
Adam Cooke
2024-03-17 18:41:26 +00:00
parent ee8d829a85
commit 7e2acccd1e
4 changed files with 11 additions and 1 deletions
+3 -1
View File
@@ -45,7 +45,9 @@ module Worker
].freeze
# @param [Integer] thread_count The number of worker threads to run in this process
def initialize(thread_count: 2, work_sleep_time: 5, task_sleep_time: 60)
def initialize(thread_count: Postal::Config.worker.threads,
work_sleep_time: 5,
task_sleep_time: 60)
@thread_count = thread_count
@exit_pipe_read, @exit_pipe_write = IO.pipe
@work_sleep_time = work_sleep_time