I am trying to proccess a queue of tasks from a database table as fast as possible while also limiting the number of threads to process the tasks.