[lib] Refactor threads queue in DMOpsQueueHandler
Summary:
https://linear.app/comm/issue/ENG-9808/consider-modifying-the-queues-logic-to-be-more-resilient
Depends on D13860
Test Plan: Add entities to the threads queue by calling processDMOps from useProcessDMOperation and verify entities are processed.
Reviewers: tomek, kamil
Reviewed By: tomek
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D13861