Currently _popReadyJob takes O(n) time to find the oldest job, which doesn't seem to scale well. I'm wondering if it's better to use a global queue (list) to record all shared jobs. In each heartbeat, the worker enqueues a shared job if it doesn't have a shared job in the queue already. And to pop a ready job, just dequeue.
Currently
_popReadyJob
takes O(n) time to find the oldest job, which doesn't seem to scale well. I'm wondering if it's better to use a global queue (list) to record all shared jobs. In each heartbeat, the worker enqueues a shared job if it doesn't have a shared job in the queue already. And to pop a ready job, just dequeue.