I have my scripts endpoints running on localhost(http://127.0.0.1:5001).
What I have:
What I currently do is calling those scripts (endpoints) one by one in a loop from .bat
file (I use windows task scheduler as my environment is windows).
How my .bat files looks now:
@echo off
for /l %%i in (1,1,50) do (
echo Page number: %%i
curl -s -o nul --max-time 120 http://127.0.0.1:5001/my-script?pageNumber=%%i
timeout /t 10
)
This works fine but it always execute one script at a time.
What I need:
I need those endpoints to be executed in pairs.
So e.g. Execute page 1 & 2 at the same time, wait until both ends and then wait 10 seconds.
Obviously for loop can be incremented by 2
for /l %%i in (1,2,50) do ()
But what ever I try with CURL it always ends up either calling page #1, and wait until it finish and then call page #2. Or calling both but don’t wait until both response.
e.g. Here is one of my failed examples:
@echo off
setlocal EnableDelayedExpansion
for /l %%i in (1,2,400) do (
set /a next=%%i+1
echo Page numbers: %%i and !next!
(curl -s -o nul --max-time 120 http://127.0.0.1:5001/my-script?pageNumber=%%i) & (curl -s -o nul --max-time 120 http://127.0.0.1:5001/my-script?pageNumber=!next!)
timeout /t 10
)
endlocal
This is probably trivial problem but I stuck here.