Add merge lock to save CPU when queue is empty