tsenart / vegeta

HTTP load testing tool and library. It's over 9000!
http://godoc.org/github.com/tsenart/vegeta/lib
MIT License
23.01k stars 1.34k forks source link

Remove unnecessary time.sleep(5) call in ramp-requests.py #659

Open kdgyun opened 8 months ago

kdgyun commented 8 months ago

Background

In the ramp-requests.py file, there's no clear reason for using sleep(5) after executing the subprocess.run() method for an attack. My guess is that when creating the process with run(), it was assumed to be non-blocking, and sleep(5) was given to match -duration 5s. If this assumption is correct, the subprocess.run() method is blocking, and it won't execute the next command until the child process finishes, making the sleep unnecessary. If there was an intention to add an arbitrary delay, there should be a specific comment or explanation. Otherwise, if someone assumes that subprocess.run() is non-blocking and adds time.sleep(5), it can cause confusion.

You can find more details about the blocking nature of subprocess in the following links:

Checklist