Fix concurrency handling in order to avoid that some workers get the same task at the same time.

With using 20 workers instances of the same group with 50 tasks in the queue the problem occurs, some tasks are executed 2 times by 2 different workers.