Hello everyone,
I have tried to find an answer to a problem and I am beginning to think that there is no solution. I share the situation with you:
It involves removing all permissions from a sharepoint list and then giving permissions again based on a condition from another list.
First I get the elements of the two lists: LISTA_PRUEBAS and PERFIL

then in the first loop I loop through the first list and remove all permissions. And then in the second nested loop I include the condition if the Terr field is equal to AREA then I add the permissions that I have defined in the PERFIL list with the GESTOR field

The problem I'm having is that this flow takes 13 hours to run.
The first list has 20,000 records and the second about 15.
The question is: do you see anything that could improve performance? Could it be done by programming the SharePoint API and make it faster?
Thank you very much for your help