Creating queue of Flows

I have around 1000 subflows, but I can simultaneously run only 20.
I would like to create a queue orchestrator for controlling the state of flows in a queue.
For example, in the beginning, it initiates 20 flows, and then every minute, the orchestrator checks the state of flows in the queue, deletes finished flows from it, and adds new ones.
I initiate a subflow with StartFlowRun. I guess I can use state_handlers somehow. state_handler can indicate that flow is finished, but I don’t know how to catch the response to it in the queue.
Maybe there is a way to loop over the queue, call the state-checking function on every flow, and define whether the flow is finished. I looked through the StartFlowRun code and Task code and couldn’t find anything helpful.