Ah, that changes a lot.
In this case I’d rather jump to “update metafield” straight from the trigger and loop over line items and count in the liquid code in metafield value.
If not – adding logging and little sleep (using Wait action) inside your loop may help if the problem is with multiple consecutive metafield updates failing.