webcompat / webcompat.com

Source code for webcompat.com
https://webcompat.com
360 stars 191 forks source link

Add a flag to kill the server after handling one request #2666

Open marimeireles opened 6 years ago

marimeireles commented 6 years ago

While running tests on profilers you constantly have to kill the server and start it over to test different things. In the moment I'm using vprof to test a few things and it requires me to terminate the program using its pid.

It can become really annoying to type ps aux | grep python, find the pid and then kill the project every time you make a new request.

So I was thinking that one thing we could do is add a flag, something like --profiler-mode that will make the server answer only one request and then terminate.

marimeireles commented 6 years ago

I think it'd help the other participants of outreachy too!

karlcow commented 5 years ago

@marimeireles could you explain a bit more on how you use vprof

--profiler-mode that will make the server answer only one request

one URL requested means often a lot of requests. We need to understand a bit more.

marimeireles commented 5 years ago

It's poorly written, sorry. In my case it wasn't one request, but a bundle of requests. I wanted to test the complete loading of one page and than terminate the profiler. But I suppose that depending on what you're testing maybe only the first request might be relevant to you.

One thing we could do is add a number, something like python run.py --profiler-mode 10 would load the first 10 requests, or maybe let the users pass the request that they want to load.

I opened this issue because I had an idea on how to implement it, but I wasn't sure if it was relevant. To this day I'm not sure it is because I ended up giving up using this kind of profiler.

What do you think? If you think it's relevant I could give it a try.