I currently have the following loop
for (const pk of likerpk)
{
await likeMediaId(ig, pk.trim());
}
the issue is that i wanted to call likeMediaId every X seconds and after the whole likeMediaId is done I wanted to call the function called Y
I have tried putting a sleep inside a for loop but that does not help, it seems that it is still executing likeMediaId in parallel, while i always want to execute 1 likeMediaId at a time
basically the flow that i wanted is (assuming 3 items in the array)
likeMediaId()
sleep 60 seconds
likeMediaId()
sleep 60 seconds
likeMediaId()
sleep 60 seconds
call function Y
what is the most elegant way in doing this?