How can I flush a json response in a controller? Didn't find this when I googled before, posting to maybe save the next person some time.
Maybe obvious for people familiar with Symfony, but was new for me; spent way too long trying to find something so simple:

$json_response = new JsonResponse($my_key_value_array);
$json_response-&gt;send();
$this-&gt;function_that_takes_a_long_time();