Skip to content

Commit

Permalink
Merge pull request locustio#7 from erlanggakrisnamukti/angga/fb_ramp_…
Browse files Browse the repository at this point in the history
…still_send_after_stop

Angga/fb ramp still send after stop
  • Loading branch information
pancaprima authored Oct 6, 2017
2 parents 62cd70d + 74173c3 commit 7a01a06
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion locust/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
app.debug = True
app.root_path = os.path.dirname(os.path.abspath(__file__))
_ramp = False
greenlet_spawner = None

@app.route('/')
def index():
Expand Down Expand Up @@ -70,6 +71,7 @@ def stop():
runners.locust_runner.stop()
response = make_response(json.dumps({'success':True, 'message': 'Test stopped'}))
response.headers["Content-type"] = "application/json"
greenlet_spawner.kill(block=True)
return response

@app.route("/stats/reset")
Expand Down Expand Up @@ -235,7 +237,8 @@ def ramp():
percentile = float(int(request.form["percentile"]) / 100.0)
fail_rate = float(int(request.form["fail_rate"]) / 100.0)
calibration_time = int(request.form["wait_time"])
gevent.spawn(start_ramping, hatch_rate, max_clients, hatch_stride, percentile, response_time, fail_rate, precision, init_clients, calibration_time)
global greenlet_spawner
greenlet_spawner = gevent.spawn(start_ramping, hatch_rate, max_clients, hatch_stride, percentile, response_time, fail_rate, precision, init_clients, calibration_time)
response = make_response(json.dumps({'success':True, 'message': 'Ramping started'}))
response.headers["Content-type"] = "application/json"
return response
Expand Down

0 comments on commit 7a01a06

Please sign in to comment.