def _shuffle_and_select_with_round_robin()

in azure-kusto-ingest/azure/kusto/ingest/_resource_manager.py [0:0]


    def _shuffle_and_select_with_round_robin(self, resources: List[_ResourceUri]) -> List[_ResourceUri]:
        # get list of resources sorted by storage account rank
        rank_shuffled_resources_list = self._get_shuffled_and_ranked_resources(resources)

        # select resources with non-repeating round robin and flatten the list
        result = []
        while True:
            if all(not lst for lst in rank_shuffled_resources_list):
                break

            for lst in rank_shuffled_resources_list:
                if lst:
                    result.append(lst.pop(0))

        return result