Refactoring the reader threads to wait if the queue gets too large and resume once the queue is almost cleared.