There should be an -TimeoutSec parameter you can feed an integer value to when calling the Invoke-WebRequest cmdlet.
Invoke-WebRequest https://www.example.com/longrunningtask -TimeoutSec 60
There should be an -TimeoutSec parameter you can feed an integer value to when calling the Invoke-WebRequest cmdlet.
Invoke-WebRequest https://www.example.com/longrunningtask -TimeoutSec 60